[RndTbl] TTY1 and Starting X Windows

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Wed Apr 19 09:16:14 CDT 2006

According to Montana Quiring:
> 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.

There's a possible race condition there, I think, so it's perhaps not the
safest way to do it.  Using "exec startx" might be better, since startx
would then replace the login shell, so there's no bash prompt (since there's
no more login shell) to return to.

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

I don't think the tty is strictly needed here.  See below...

> This is what is in my /etc/inttab:
> id:2:initdefault

This says the default run level is 2, so only inittab entries with a 2 in
their run level list will be considered...

> ....the rc scripts setup and stuff...
> 1:2345:respawn:/sbin/getty 38400 tty1
> 2:23:respawn:/sbin/getty 38400 tty2

These will work, since 2 is among their list of run levels.

> x:5:respawn:/usr/X11R6/bin/startx > tty1

This line will only work at run level 5, so you can either...

- change that to a 2, so it runs at the default run level,

- change the initdefault line to use run level 5, but that might break other

- have a command run somewhere at the end of all the run level 2 stuff,
  which says "/sbin/init 5" to change the run level.  That's rather
  convoluted, though.  (But it's similar to what Solaris's init scripts do.)

> Thanks for your patience. I haven't worked with inittab much in the past,
> so this has been a real learning experience for me.

It's worth a careful read of the init(8) and inittab(5) man pages, to better
understand the concepts behind it.  After than, the setup makes more sense.

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