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. :oops:

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:

About these ads

4 Responses to “Weird science: mc, without tty”


  1. 1 Adrian 2010/08/19 at 6:38 PM

    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?

    • 2 Kaleb Elwert 2010/08/19 at 9:03 PM

      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. 3 johnraff 2010/08/20 at 3:11 AM

    There’s a mingetty variant called rungetty that can run any program instead of login:
    http://packages.debian.org/squeeze/rungetty

  3. 4 anon 2010/08/20 at 1:38 PM

    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:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,958,119 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: