Chapter 7. Booting and Configuring a Linux System

Table of Contents

7.1. The Linux Boot Process
7.2. The init Program
7.3. Runlevels
7.4. Changing Runlevels
7.5. Init Scripts
7.6. System Services (Runlevel)
7.7. SuSEconfig and /etc/sysconfig
7.8. The YaST sysconfig Editor


Booting a Linux system is a complex procedure. Many different components are involved and need to interact flawlessly. This chapter provides a basic explanation of the underlying principles and the components involved. The concept of runlevels and SUSE's system configuration with sysconfig are also discussed in this chapter.

7.1. The Linux Boot Process

The Linux boot process consists of several stages each represented by another component. The following list briefly summarizes the boot process and features all the major components involved.

  1. BIOS

    After the computer has been turned on, the BIOS initializes the screen and keyboard and tests the main memory. Up to this stage, the machine does not access any mass storage media. Subsequently, the information about the current date, time, and the most important peripherals are loaded from the CMOS values (CMOS Setup). When the first hard disk and its geometry are recognized, the system control passes from the BIOS to the boot loader.

  2. Boot Loader

    The first physical 512-byte data sector of the first hard disk is loaded into the main memory and the boot loader that resides at the beginning of this sector takes over. The commands executed by the boot loader determine the remaining part of the boot process. Therefore, the first 512 bytes on the first hard disk are referred to as the Master Boot Record (MBR). The boat loader then passes control to the actual operating system, in this case, the Linux kernel. More information about GRUB, the Linux boot loader, can be found in Chapter 8, The Boot Loader.

  3. Kernel and initrd

    To pass system control, the boot loader loads both the kernel and an initial RAM disk (initrd) into memory. The Linux kernel contains an option of having small file systems loaded to a RAM disk and running programs before the actual root file system is mounted. The kernel then decompresses the initrd and mounts it as a temporary root file system. The contents of initrd is a minimal Linux system that contains an executable called linuxrc. This executable is executed before the real root file system is mounted. If possible, the kernel frees the memory occupied by initrd and starts init after linuxrc terminates successfully. More information about initrd can be found in Section 7.1.1, “initrd”.

  4. linuxrc

    This program performs all actions needed to mount the proper root file system, like providing kernel functionality for the needed file system and device drivers for mass storage controllers. As soon as the actual root file system has been successfully mounted, linuxrc stops and the kernel starts the init program. More information about linuxrc is provided in Section 7.1.2, “linuxrc”.

  5. init

    init handles the actual booting of the system through several different levels providing different functionality. init is described in Section 7.2, “The init Program”.

7.1.1. initrd

initrd is a small (typically compressed) file system that the kernel can load to a RAM disk then mount as temporary root file system. It provides a minimal Linux environment that enables the execution of programs before the actual root file system is mounted. This minimal Linux environment is loaded into memory by BIOS routines and does not have specific hardware requirements other than sufficient memory. The initrd always has to provide an executable named linuxrc that needs to exit without error.

Before the actual root file system can be mounted and the actual operating system can be started, the kernel needs the corresponding drivers to access the device on which the root file system is located. These drivers may include special drivers for a certain kind of hard drives or even network drivers to access a network file system (see Managing Network Configuration). The kernel must also contain the code needed to read the file system of the initrd. The needed modules for the root file system may be loaded by linuxrc.

Create an initrd with the script mkinitrd. In SUSE LINUX, the modules to load are specified by the variable INITRD_MODULES in /etc/sysconfig/kernel. After installation, this variable is automatically set to the correct value (the installation linuxrc saves which modules were loaded). The modules are loaded in exactly the order in which they appear in INITRD_MODULES. This is especially important if several SCSI drivers are used, because otherwise the names of the hard disks would change. Strictly speaking, it would be sufficient just to load those drivers needed to access the root file system. However, all SCSI drivers needed for installation are loaded by means of initrd because later loading could be problematic.

[Important]Updating initrd

The boot loader loads initrd in the same way as the kernel. It is not necessary to reinstall GRUB after updating the initrd, because GRUB searches the directory for the right file when booting.

7.1.2. linuxrc

The main purpose of linuxrc is to prepare the mounting of and access to the real root file system. Depending on your actual system configuration, linuxrc is responsible for the following tasks.

Loading Kernel Modules

Depending on your hardware configuration, special drivers may be needed to access the hardware components of your computer (the most important component being your hard drive). To access the final root file system, the kernel needs to load the proper file system drivers.

Managing RAID and LVM Setups

If you configured your system to hold the root file system under RAID or LVM, linuxrc sets up LVM or RAID to enable access to the root file sytem later. Information about RAID can be found in Section 3.8, “Soft RAID Configuration”. Information about LVM can be found in Section 3.7, “LVM Configuration”.

Managing Network Configuration

If you configured your system to use a network-mounted root file system (mounted via NFS), linuxrc must make sure that the proper network drivers are loaded and that they are set up to allow access to the root file system.

When linuxrc is called during the initial boot as part of the installation process, its tasks differ from those mentioned earlier:

Finding the Installation Medium

As you start the installation process, your machine loads an installation kernel and a special initrd with the YaST installer from the installation medium. The YaST installer, which is run in a RAM file system, needs to have information about the actual location of the installation medium to access it and install the operating system.

Initiating Hardware Recognition and Loading Appropriate Kernel Modules

As mentioned in Section 7.1.1, “initrd”, the boot process starts with a minimum set of drivers that can be used with most hardware configurations. linuxrc starts an initial hardware scanning process that determines the set of drivers suitable for your hardware configuration. These values are later written to INITRD_MODULES in /etc/sysconfig/kernel to enable any subsequent boot process to use a custom initrd. During the installation process, linuxrc loads this set of modules.

Loading the Installation System or Rescue System

As soon as the hardware has been properly recognized and the appropriate drivers have been loaded, linuxrc starts the installation system, which contains the actual YaST installer, or the rescue system.

Starting YaST

Finally, linuxrc starts YaST, which starts package installation and system configuration.

7.1.3. For More Information

For more information, see /usr/src/linux/Documentation/ramdisk.txt, /usr/src/linux/Documentation/initrd.txt, and the man page initrd(4) and mkinitrd(8).

SUSE LINUX Administration Guide 9.3