Weird science: mc, without tty

Sometimes I’m not really sure what I am doing, aside from trying to break things. On a weird thought the other day, I dug into the /etc/inittab file on my one machine running Arch Linux, and substituted Midnight Commander for the first agetty command there.

After all, you can swap that out for mingetty or *getty or any other “login manager,” so why not a regular application like I normally use? Couldn’t that take the place of an autostart from the bash prompt?

Well, I’m not really sure what I was expecting to happen, but what I got was an instance of mc running in tty1, and because I had tagged that line with the “respawn” flag, it simply rolled back into place every time I tried to quit out of it.

How quaint, I thought. A permanent file manager with the press of ALT+F1. But it was running as root, and so my next thought was to trigger mc the same way I trigger X at boot, with this line.

c3:2345:respawn:/bin/su kmandla -l -c "/bin/bash --login -c /usr/bin/mc"

I put that in c3 and commented out c1, because mc was landing in tty1 no matter which line started it. And because I usually only run two tty’s at a time anyway.

And got roughly the right results: mc running as the regular user in tty1. Every time I tried to exit, it simply started up again.

How about two? I thought. But adding another program just created havoc. If I added htop and mc, they both tried to compete for that first “tty”, and just made a mess out of the screen.

Well, I thought, the obvious solution here is to start screen and then let both of them live inside that marvelous program.

But screen wasn’t having any of that business, crashing rather loudly, rather quickly and quite repeatedly — which triggered the respawn warning and an admonishment from the system. 😳

I tried swapping “respawn” for both “wait” and “once,” but then the only message was a refusal from screen — that it “couldn’t find /dev/console,” and was giving up.

At which point I gave up as well. I don’t know what I intended to achieve with this, and I don’t even know what I could expect to achieve with it. But perhaps sometime in the future this will come in handy.

Which is why I make a note of it here. Because that’s what this blog is for. :mrgreen:


4 thoughts on “Weird science: mc, without tty

  1. Adrian

    Seems to me like this could be a “substitute” for tiling WMs or even your use of screen.

    Think about it, let’s say you could assign a specific program to all TTY’s (there’s twelve of them, right?). Then you could just switch to the TTY showing the program you need, log in and bam. There you’ve got it.

    Once you don’t need it anymore, log out, and it won’t abuse any resources at all.

    What do you think?

    1. Kaleb Elwert

      The interesting thing about this solution is that you don’t need to login. There is no tty, so there’s nowhere to log in to.

      Optionally, you could have mingetty (I think) log you in as a user and use the .bashrc or .zshrc to start something if [[ $(tty) = “/dev/tty1” ]]
      Or other options. I use this to startx whenever I login to tty1. Might have to try a 100% console based system though on my new old laptop and start messing with this.

  2. anon

    This is the coolest thing I’ve ever seen you post. I think you should experiment more with this.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s