In the Beginning Was init

When the system starts, and after the kernel has configured everything and mounted the root file system, it executes /sbin/init [27]. init is the father of all processes on 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 called /etc/inittab. This file has its own manual page (inittab(5)), so we'll document just a few of the configuration values possible.

The first line which should be the focus of your attention is this one:

si::sysinit:/etc/rc.d/rc.sysinit

This line tells init that /etc/rc.sysinit is to be run once the system has been initialized. (si stands for System Init) To determine the default runlevel, init will then look for the line containing the initdefault keyword:

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) some programs that can't be started by any other process. For example, each of the login programs that run on the six virtual consoles are started by init. [28]. For the second virtual console, this gives:

2:2345:respawn:/sbin/mingetty tty2



[27] Which is why putting /sbin on a file system other than the root is a very bad idea. The kernel hasn't mounted any other partitions at this point, and therefore won't be able to find /sbin/init.

[28] If you don't want six virtual consoles, you may add or remove them by modifying this file. If you're increasing the number of consoles, you can have a maximum of 64. But don't forget that X also runs on a virtual console, so leave it at least one free for it.