Your Debian system boots X Windows automatically, probably with Gnome Display Manager (GDM), K Display Manager (KDM), or X Display Manager (XDM). But, Debian does not install with both text and graphical runlevels already configured like Red Hat; runlevels 2–5 by default are all the same. Because you chose a graphical login during installation, runlevels 2–5 all boot to a graphical login. How do you configure it to boot to a text-only session?
First, you need to know which display manager the system is using. Then, remove it from the appropriate runlevels. To see which one is running:
$ ps ax | grep dm
537 | S 0:00 /usr/bin/gdm
544 | S< 0:10 /usr/X11R6/bin/X :0 -dpi 100 -nolisten tcp vt7 -auth /var/
lib/gdm/A:0-PbCLdj
This tells us that GDM, the Gnome Display Manager, is running. First, remove it from all runlevels:
# update-rc.d -f gdm remove
update-rc.d: /etc/init.d/gdm exists during rc.d purge (continuing)
Removing any system startup links for /etc/init.d/gdm ...
/etc/rc0.d/K01gdm
/etc/rc1.d/K01gdm
/etc/rc2.d/S99gdm
/etc/rc3.d/S99gdm
/etc/rc4.d/S99gdm
/etc/rc5.d/S99gdm
/etc/rc6.d/K01gdm
Next, have GDM start on runlevel 5, and stop on all the others:
# update-rc.d gdm start 99 5 . stop 01 0 1 2 3 4 6 .
Adding system startup for /etc/init.d/gdm ...
/etc/rc0.d/K01gdm -> ../init.d/gdm
/etc/rc1.d/K01gdm -> ../init.d/gdm
/etc/rc2.d/K01gdm -> ../init.d/gdm
/etc/rc3.d/K01gdm -> ../init.d/gdm
/etc/rc4.d/K01gdm -> ../init.d/gdm
/etc/rc6.d/K01gdm -> ../init.d/gdm
/etc/rc5.d/S99gdm -> ../init.d/gdm
Now, edit /etc/inittab to set the default runlevel so that the system boots into text mode. Debian's default runlevel is 2, so why not stick with tradition:
# The default runlevel. id:2:initdefault:
Now refer to Recipe 17.2 or Recipe 17.3 to finish setting up your server.
Booting to text mode still gives you the option to run X Windows
when you want; simply run the startx
command on the server to start up X
Windows. You won't see an X session over the serial line—this only
makes sense when you want an X session on an attached monitor, or you
are running remote X clients from the server.
update-rc.d is the Debian command for
editing runlevels. The -f
flag
means "force removal of symlinks even if
/etc/init.d/<name> still exists." Runlevels
are simply big batches of symlinks, which you can see in the
/etc/rc*.d directories. This preserves the
startup script in /etc/init.d, which you
definitely do not want to delete. If you're feeling nervous, run
update-rc.d-f-n<foo>
first to
do a dry run, the -n
switch meaning
"not really."
man 8 update-rc.d
man 1 startx
Remote Serial Console HOWTO:
Chapter 7, "Starting and Stopping Linux," in Linux Cookbook, by Carla Schroder (O'Reilly) tells how to customize runlevels
Recipe 15.2, "Using Both X Windows and Consoles," in Linux Cookbook