The runlevel is an identifier for each of the different states in
which the GNU/Linux operating system can be running, such as in single
user mode, multi-user mode, and halt and reboot modes. Generally a
GNU/Linux system is running in multi-user mode.
The first script run by init, after booting into GNU/Linux,
is /etc/init.d/rcS. The initialisation files for the default
run level (usually 2) are then run. This is specified in
/etc/inittab with the line:
This runs /etc/init.d/rc with the parameter 2. The
/etc/init.d/rc script in turn runs the scripts in
/etc/rc2.d/ (since the parameter 2 indicates rc2 as opposed
to rc3, etc).
The default runlevel is runlevel 2, unless you change it in
# The default runlevel.
In general the runlevels 2, 3, 4, and 5 are all multi-user run levels
and Debian sets them up to be the same.
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
Thus, when the system enters a runlevel it executes the scripts in
/etc/rc.n where n is the runlevel in question. These scripts
are in fact symbolic links (symlinks) to scripts in
/etc/init.d/. A script starting with S starts a
service. One starting with K stops a service. The number
after the `S' or `K' specifies the order in which the scripts are run.
For example, S25xdm will start before S35xdm.
To stop xdm, for example, from starting up by default on boot,
simply remove the symbolic link of the corresponding `S' script from
See the man page for init for an extensive discussion.
The init script is run with "start" on changing runlevel (S) and
runlevels 0 (the halt runlevel) and 6 (the reboot runlevel).
To remove something (e.g., gdm) from the init scripts:
# update-rc.d -f gdm remove
Copyright © 1995-2006 [email protected]