[RndTbl] TTY1 and Starting X Windows

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Tue Apr 18 15:08:48 CDT 2006

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/11b044eeebe0a238?hl=en

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

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


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).

Gilbert E. Detillieux		E-mail:	<gedetil at cs.umanitoba.ca>
Dept. of Computer Science	Web:	http://www.cs.umanitoba.ca/~gedetil/
University of Manitoba		Phone:	(204)474-8161
Winnipeg, MB, CANADA  R3T 2N2	Fax:	(204)474-7609

More information about the Roundtable mailing list