[lug] X, Window Managers and KDE/gnome 101

Aaron Crane aaron.crane at pobox.com
Wed Dec 20 14:01:42 MST 2000


Tkil <tkil at scrye.com> writes:
> >>>>> "Nate" == Nate Duehr <nate at natetech.com> writes:
> Nate> There's no direct relationship between whether or not X starts and
> Nate> the run level of the machine unless you make it so.
> 
> true.  but i suspect that, even on Debian, you would want to start looking
> at /etc/inittab to see what is started when the machine starts.

Well, yes, but it doesn't tell you all that much.  /etc/inittab on Debian is
nice and simple: it starts a few gettys and runs two scripts.

> (unless Debian uses something other than sysvinit, which i doubt, but
> would welcome corrections.)

Use of sysvinit doesn't in and of itself imply anything much about how
system startup works.  Sysvinit does little more than define the existence
of certain runlevels (0 = halt, 1 = single-user, 6 = reboot, 2..5 = normal,
S = `special' or `system' or `single') and the interpretation of the
/etc/inittab file.  Apart from that, it's up to the system integrator how to
actually manage startup in a sensible way; different Linux distributions can
and do select slightly different procedures.

Debian adopts what I consider a straightforward and consistent scheme.  For
each runlevel R, there is a directory /etc/rcR.d which contains files whose
names match [SK][0-9][0-9]*.  Each one should be a program accepting one
argument -- normally either "start" or "stop", but "restart", "reload", and
"force-reload" also have defined meanings.  When entering a runlevel, all
the Knn files for that runlevel are executed with an argument of "stop", and
then all the Snn files are executed with an argument of "start".  [This is a
slight simplification, but that's essentially what happens.]

All the real work of getting the system going is done by such scripts.  The
basics are in /etc/rcS.d (since S is the initial runlevel unless doing an
emergency boot).  Other stuff is usually in /etc/rc2.d (since 2 is the
default runlevel to switch to after getting to runlevel S).

> Nate> RedHat has chosen to do so, and they automatically start X whenever
> Nate> the system is at runlevel 5.  Debian takes a completely different
> Nate> approach to this.  If XDM's installed, it's assumed that you want to
> Nate> launch X automagically.
> 
> uhg.  out of curiosity, where's the magic?  does init launch something
> that conditionally launches x, or... ?

It falls out naturally from Debian's approach to startup files: /etc/rc2.d
contains a file S99xdm (or S99wdm, S99gdm, S99kdm, etc.), supplied with and
installed by the relevant display manager package.  This script starts or
stops the display manager as appropriate, and the display manager in turn
can launch one or more X servers.

If you want your Debian box to have an X-less runlevel and a default, X-ful
one, then the easiest thing to do is to rename /etc/rc3.d/S99xdm to
/etc/rc3.d/K99xdm.  Now runlevel 2 is still the default, and still runs xdm.
But if you boot into runlevel 3, no display manager (and hence no X server)
will be run.

-- 
Aaron Crane




More information about the LUG mailing list