10.5 Every distribution seems to have a different boot-up method. Tell me about Debian's.
Like all Unices, Debian boots up by executing the program init.
The configuration file for init (which is
/etc/inittab) specifies that the first script to be executed
should be /etc/init.d/rcS. This script runs all of the scripts in
/etc/rcS.d/ by sourcing or forking subprocess depending on their
file extension to perform initialization such as to check and to mount file
systems, to load modules, to start the network services, to set the clock, and
to perform other initialization. Then, for compatibility, it runs the files
(except those with a `.'in the filename) in /etc/rc.boot/ too.
Any scripts in the latter directory are usually reserved for system
administrator use, and using them in packages is deprecated.
After completing the boot process, init executes all start scripts
in a directory specified by the default runlevel (this runlevel is given by the
entry for id in /etc/inittab). Like most System V
compatible Unices, Linux has 7 runlevels:
-
2 through 5 (various multi-user modes), and
Debian systems come with id=2, which indicates that the default runlevel will
be '2' when the multi-user state is entered, and the scripts in
/etc/rc2.d/ will be run.
In fact, the scripts in any of the directories, /etc/rcN.d/ are
just symbolic links back to scripts in /etc/init.d/. However, the
names of the files in each of the /etc/rcN.d/ directories
are selected to indicate the way the scripts in
/etc/init.d/ will be run. Specifically, before entering any
runlevel, all the scripts beginning with 'K' are run; these scripts kill
services. Then all the scripts beginning with 'S' are run; these scripts start
services. The two-digit number following the 'K' or 'S' indicates the order in
which the script is run. Lower numbered scripts are executed first.
This approach works because the scripts in /etc/init.d/ all take
an argument which can be either `start', `stop', `reload', `restart' or
`force-reload' and will then do the task indicated by the argument. These
scripts can be used even after a system has been booted, to control various
processes.
For example, with the argument `reload' the command
/etc/init.d/sendmail reload
sends the sendmail daemon a signal to reread its configuration file. (BTW,
Debian supplies invoke-rc.d
as a wrapper for invoking the scripts
in /etc/init.d/.)