Certification Objective 4.08: The Basic Boot Process

 < Day Day Up > 

Understanding how your system boots and shuts down will help you immensely as a Red Hat system administrator. Red Hat Enterprise Linux uses a boot process called System V init, which means that after the kernel is loaded, it starts a program called init, which then starts everything else. To understand the process better, let's go through the steps Red Hat Enterprise Linux takes to boot itself up to a usable system.

Once you understand the basic boot process, Red Hat Enterprise Linux provides two utilities that assist the system administrator in configuring and maintaining the commands that make up that startup and shutdown process. The redhat-config-services utility provides a GUI interface, while chkconfig provides a command line interface to manage services at different runlevels. Before we begin, it's important to understand Red Hat runlevels before reading about the boot process.

Exam Watch 

The Red Hat course associated with the RHCT, RH133, explicitly requires that you understand what happens during the Linux boot process.


There are six basic runlevels in Red Hat Enterprise Linux, as defined in /etc/inittab. Each runlevel is associated with a level of functionality. For example, in single-user mode, also known as runlevel 1, only one user is allowed to connect to that Linux system. X11 mode, also known as runlevel 5, starts Linux into a GUI login screen. The Red Hat definitions for System V init runlevels are shown in Table 4-19.

Table 4-19: Red Hat Runlevels






Single-user mode, for maintenance (backups/restores) and repairs


Multiuser, without networking


Multiuser, with networking




X11, defaults to a GUI login screen. Logins bring the user to a GUI desktop.


Reboot (never set initdefault in /etc/inittab to this value!)

Making each runlevel work is the province of a substantial number of scripts. Each script can start or stop fundamental Linux processes such as printing (cupsd), scheduling (crond), Apache (httpd), Samba (smbd), and more. The starting and stopping of the right scripts becomes part of the boot process.

It should go without saying that if you set your initdefault to 0, your system will shut down when Linux tries to boot. Likewise, if you set the initdefault to 6, Linux will enter a continuous reboot cycle.

Exam Watch 

For the Troubleshooting and System Maintenance exam, it can be useful to back up and then modify critical configuration files such as /etc/inittab. But remember to do this on a test computer; if you can't solve the problem, you may lose the data on that computer. Before you proceed, learn the rescue mode techniques described in Chapter 11.

The Boot Process

When you start your computer, the BIOS checks your system, and looks for a bootloader such as GRUB. It finds and installs the Linux kernel. Then Linux can start installing the services you have configured.

The kernel always starts by calling init. The init process in turn runs /etc/rc.d/rc.sysinit, which performs a number of tasks, including network configuration, keyboard maps, partition mounts, and hostnames. The init process then determines which runlevel it should be in by looking at the initdefault entry in /etc/inittab. A runlevel is defined as a group of activities. For example, the entry:


shows a default starting point in runlevel 5. Next, init starts the appropriate scripts associated with runlevel 5, from the /etc/rc.d directory. That directory includes the following subdirectories:

init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d

If the default runlevel is 5, init will look in /etc/rc.d/rc5.d and run each 'kill' and 'start' script it finds in that directory. A kill script is any file or symbolically linked file with a name that begins with a 'K.' Likewise, start scripts start with 'S.' If you run an ls -l command in this directory, you'll see only symbolic links to the actual scripts in /etc/rc.d/init.d. Observe current examples of kill and start scripts at runlevel 5 in Figure 4-8.

click to expand
Figure 4-8: Sample kill and start scripts in runlevel 5

What's going on here? System V init knows to go to the directory associated with a particular runlevel. Once there, init runs the scripts in that directory that start with a K and then the scripts starting with an S. The K scripts stop processes that aren't supposed to operate in that runlevel. The S scripts start the processes associated with that runlevel. Within each category, scripts are run in numeric order; for example, K20nfs is run before K50tux, which is run before S10network.

Red Hat uses six different runlevels: 0, 1, 2, 3, 5, and 6. (Runlevel 4 is unused as of this writing.) Symbolic links allow the collection of all init scripts in one directory, /etc/init.d. Any changes to a start or kill script can be made in that directory.

You can run a start script yourself, with some key switches. For example, you can run the smbd (Samba) and sshd (secure shell daemon) scripts with the following options:

# /etc/rc.d/init.d/smb Usage: /etc/rc.d/init.d/smb {start|stop|restart|reload|status|condrestart} # service smb    # service is a shortcut to the management scripts Usage: /etc/rc.d/init.d/smb {start|stop|restart|reload|status|condrestart} # service sshd Usage: sshd {start|stop|restart|reload|condrestart|status} #

For example, the /etc/rc.d/init.d/smb restart command stops and starts Samba. See from the code how you can substitute the service command for /etc/rc.d/init.d in this command. It's one more timesaver that you can use on the Red Hat exams.

This is used by the scripts at each runlevel. In other words, if there is a K script for the smbd daemon, init runs /etc/rc.d/init.d/smb stop. And naturally, an S script for the ssh daemon runs /etc/rc.d/init.d/sshd start.

Exam Watch 

Make sure you go through the /etc/rc.d hierarchy as well as the /etc/ inittab and /etc/rc.d/rc.sysinit files, and understand what's happening along the way. This is the key to understanding what's happening during the boot process.

 < Day Day Up > 

RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
ISBN: 71765654
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net