inittab explained


Forgive me this time for taking up /etc/inittab file details here. But trust me, many of you will learn something new about inittab file apart from your knowledge that it control the “runlevels“. I know you had learned it in your Red Hat Linux RHCE Training.

Keep on reading —

When the init daemon needs to change the runlevel of the system by starting or stopping daemons, it consults the /etc/inittab file. This file is also consulted when bringing the system to a certain runlevel at boot time.

The format of entries in the /etc/inittab file are as follows:

label : runlevel(s) : action : command

The label is an identifier that allows the init daemon to examine this file in alphabetical order; the runlevel specifies to which runlevel the line in /etc/inittab corresponds; the command tells the init daemon what to execute when entering the runlevel; and the action tells the init daemon how to execute the command.

Thus, the line


in the /etc/inittab file tells the init daemon that runlevel 5 is the default runlevel to boot to when initializing the Linux system at system startup.

Secondly, the line


tells the init daemon to run the program /etc/rc.d/rc.sysinit before entering a runlevel at system initialization. This program initializes
the hardware components of the system, sets environment variables such as PATH and HOSTNAME, checks filesystems, & performs system tasks required for daemon loading. The output from the /etc/rc.d/rc.sysinit program is displayed on the terminal screen during system startup as soon as the graphical boot starts. GEEKS, you can always press alt+d to check this output.

Now, GEEKS here the default runlevel is 5, so the line l5:5:wait:/etc/rc.d/rc 5 will be executed in the next section of the /etc/inittab file seen earlier. This will throw the control to line /etc/rc.d/rc 5 & waits for it to finish before proceeding to the rest of the /etc/inittab file.

The remainder of the /etc/inittab file loads optional components & allows for login programs to run on terminals. For terminal logins, the mingetty program is started on tty1 through tty6 and restarted (respawn) continuously to allow for login after login.

In addition, gdm is started only upon entering runlevel 5 from the last entry in /etc/inittab.

After the entries in /etc/inittab have been executed, the /etc/rc.d/rc.local file is executed to perform tasks that must occur after system startup. The entire Linux initialization process is summarized and illustrated in the snapshot attached.

inittab explained

inittab explained