Chapter 11. The startup files: init sysv

Table of Contents
11.1. In the beginning was init
11.2. Runlevels

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 more simple, but the System V scheme, although less easy to understand (which will change once you finish this chapter), is definitely more flexible to use.

11.1. In the beginning was init

When the system starts, and after the kernel has configured everything and mounted the root filesystem, it executes /sbin/init [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 (inittab(5)), 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
This instruction tells init that /etc/rc.sysinit is to be run on initialization of the system before anything else. To determine the default runlevel, init then looks 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, which it is the only process capable of restarting. This is the case, for example, for all login programs which run in each of the 6 virtual consoles[2]. For the second virtual console, this gives:
2:2345:respawn:/sbin/mingetty tty2

Notes

[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.


Tux on Star from MandrakeSoft Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
Unless otherwise stated, all the content of these pages and all images are Copyright MandrakeSoft S.A. and MandrakeSoft Inc. 2001.
http://www.mandrakelinux.com/