In the Unix tradition, there are two system startup schemes: the BSD scheme and the "System V" scheme, both named after the Unix system which implemented them first (resp. Berkeley Software Distribution and AT&T Unix System V). The BSD scheme is the simplest, but the System V scheme, although less easy to understand (which will change once you finish this chapter), is definitely more flexible to use.
When the system starts, and after the kernel has configured everything and mounted the root filesystem, it starts the /sbin/init program[1]. init is the father of all processes of the system, and it is responsible for taking the system to the desired runlevel. We will look at runlevels in the next section.
The init configuration file is /etc/inittab. This file has its own manual page (man inittab), but here we will describe only a few of the configuration items.
The first line which should be the focus of your attention is this one:
si::sysinit:/etc/rc.d/rc.sysinit |
id:5:initdefault: |
In this case, init knows that the default runlevel is 5. It also knows that to enter level 5, it must run the following command:
l5:5:wait:/etc/rc.d/rc 5 |
As you can see, the syntax for each runlevel is similar.
init is also responsible for restarting (respawn) certain programs, which only it is capable of restarting. This is the case, for example, for all login programs which run in each of the 6 virtual terminals[2]. For the second virtual console, this gives:
2:2345:respawn:/sbin/mingetty tty2 |
[1] | Now you see why putting /sbin on a filesystem other than the root filesystem is a very bad idea :-) |
[2] | So you can, if you want, add or remove virtual consoles by modifying this file, up to a maximum of 64, by following the syntax. But don't forget that X also runs on a virtual console! So leave it at least one free for it. |