Special Purpose Entries

Using what you have just learned about the syntax of the inittab file, take a closer look at the sample in Listing 1.4. You can ignore most of the file; more than half of it consists of comments. Many of the other lines are entries that are used only for special functions:

• The id entry defines the default runlevel, which is usually 3 for a text console or 5 for an X console.

• The ud entry calls the /sbin/update process, which cleans up the I/O buffers before disk I/ O starts in order to protect the integrity of the disks.

• The pf, pr, and ca entries are invoked only by special interrupts.

Warning Some administrators are tempted to change the ca entry to eliminate the ability to reboot the system with the three-finger salute. This is not a bad idea for server systems, but don't do it for desktop systems. Users need to have a method to force a graceful shutdown when things go wrong. If it is disabled, the user might resort to the power switch, which can result in lost data and other disk troubles.

Six of the lines in the inittab file start—and when necessary, restart—the getty processes that provide virtual terminal services. One example from Listing 1.4 explains them all:

3:2345:respawn:/sbin/mingetty tty3

The label field contains a 3, which is the numeric suffix of the device, tty3, to which the process is attached. This getty is started for runlevels 2, 3, 4, and 5. When the process terminates (for example, when a user terminates the connection to the device), the process is immediately restarted by init.

The pathname of the process that is to be started is /sbin/mingetty. Red Hat uses mingetty, which is a minimal version of getty that is specifically designed for virtual terminal support. On a Caldera 2.2 system, the pathname would be /sbin/getty with the VC command-line option, which tells getty that it is servicing a virtual terminal. The result, however, would be the same: to start a virtual terminal service process for tty3.

Every runlevel that accepts terminal input uses getty. Runlevel 5 has one additional entry in the inittab file to start an X terminal:

x:5:respawn:/etc/X11/prefdm -nodaemon

This line starts—and when necessary, restarts—the X application used for the X-based console logon required by runlevel 5.

Every line in the inittab file handles some important task. However, the real heart of the inittab file consists of the seven lines that follow the comment "System initialization" near the beginning of the inittab file (refer to Listing 1.4.) They are the lines that invoke the startup scripts. The first of these is the si entry:

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

This entry tells init to initialize the system by running the boot script located at /etc/rc.d/rc.sysinit. This script, like all startup scripts, is an executable file that contains Linux shell commands. Notice that the entry shows the full path to the startup script. One of the most common complaints about different Linux distributions is that the key files are stored in different locations in the filesystem. Don't worry about memorizing these differences—just look in the /etc/inittab file. It tells you exactly where the startup scripts are located.

The six lines that follow the si entry in inittab are used to invoke the startup scripts for each runlevel. Except for the runlevel involved, each line is identical:

This line starts all of the processes and services needed to provide the full multiuser support defined by runlevel 5. The label is l5, which is symbolic of level 5. The runlevel is, of course, 5. init is directed to wait until the startup script terminates before going on to any other entries in the inittab file that relate to runlevel 5. init executes the script /etc/rc.d/rc, and passes that script the command-line argument 5.

Was this article helpful?

0 0

Post a comment