According to Montana Quiring:
Hello,
Thanks for your feedback at the last MUUG meeting about the problem I had with Control+C droping someone to a shell prompt in the forst TTY.
I had a google group thread here if you want to read/respond there: http://groups.google.ca/group/ubuntu_lite/browse_thread/thread/11b044eeebe0a...
If you read this thread to the end, you'll see that the X server is launched from within root's ~/.bash_profile, which would explain why you see this problem...
I changed the line in /etc/inittab from: 1:2345:respawn:/bin/bash -login > /dev/tty1 2>&1 < /dev/tty1 to: 1:2345:respawn:/sbin/getty 38400 tty1
and that solves to problem of getting to a shell but now X Windows doesn't start.
I don't fully understand what the orig line is doing and I think that's my problem.
As Bill mentioned, the redirect stuff is what you see at the end of the line. however, the /bin/bash -login is the key part here. The -login option forces bash to treat this as a login shell, and read the .bash_profile for the logged-in user (root in this case, since init runs as root, and nothing has been done to change to a different userid).
This strikes me as a roundabout way of doing things, and also (as you've discovered) not very bullet-proof. I'd recommend you change the .bash_profile to not start the X server from there, but rather start it in its own line in /etc/inittab, such as this...
x:5:respawn:/usr/X11R6/bin/startx
Decide which runlevel(s) is/are appropriate for this system, of course. Also, you may want to just use the command line you've commented out of the .bash_profile, if it's different than the startx above, but you will need to specify the full path name of the command explicitly, I believe.
Also note that commands started in inittab aren't automatically bound to a tty (such as a virtual console), so you might need to explicitly do so using redirects (as they did for the bash -login). That's not necessary when you invoke getty, since you specify a tty as a command line argument to it, and it's job is to set up a process group bound to the tty. This likely won't matter in the case of X, but if you want to debug or check output from the X server or clients, then you should redirect it somewhere (a log file if not a virtual console).
If you read this thread to the end, you'll see that the X server is launched from within root's ~/.bash_profile, which would explain why you see this problem...
Hee hee. Ya, that was me that posted that. *wink*
This strikes me as a roundabout way of doing things, and also (as you've discovered) not very bullet-proof. I'd recommend you change the .bash_profile to not start the X server from there, but rather start it in its own line in /etc/inittab, such as this...
x:5:respawn:/usr/X11R6/bin/startx
Also note that commands started in inittab aren't automatically bound to a tty (such as a virtual console), so you might need to explicitly do so using redirects (as they did for the bash -login). That's not necessary when you invoke getty, since you specify a tty as a command line argument to it, and it's job is to set up a process group bound to the tty. This likely won't matter in the case of X, but if you want to debug or check output from the X server or clients, then you should redirect it somewhere (a log file if not a virtual console).
Thanks for all the info Gilbert. You put me on the right path. I found that if I put: startx; kill -9 $$ in the ~/.bash_profile It goes to a login prompt instead of a BASH prompt after the user presses Control+C, so that's a temp workaround. I would like to get your suggestion working in /etc/inittab I put the line: x:5:respawn:/usr/X11R6/bin/startx in my /etc/inittab after the other getty TTY's ...but like you said it looks like I need to redirect it to a tty, as X does not start up. I've been googling trying to figure out how to do that, but no dice yet. If you can give me a hint I'd appreciate it.
This is what is in my /etc/inttab: id:2:initdefault ....the rc scripts setup and stuff... 1:2345:respawn:/sbin/getty 38400 tty1 2:23:respawn:/sbin/getty 38400 tty2 x:5:respawn:/usr/X11R6/bin/startx > tty1
Thanks for your patience. I haven't worked with inittab much in the past, so this has been a real learning experience for me.