The booting process involves starting a computer and loading the operating system into memory. It begins when the computer is powered on, performing hardware checks, loading the boot loader, and eventually the operating system.
Key takeaways:
The Linux boot process is a sequence from power-on to the login prompt, initializing hardware, loading the kernel, and starting system services.
The Linux boot process involves several stages: BIOS initializes hardware and searches for the boot loader, which is the coordinator boot record (CBR) in the Linux context. The CBR contains information about the GRUB boot loader, which loads the kernel and initrd (initial RAM disk). The kernel mounts the root file system and executes the init process.
After the kernel starts, the init system sets the default run level based on the configuration in
/etc/inittab
. It then executes services and programs in the order specified by the run-level directories (e.g.,/etc/rc.d/rc3.d/
). This ensures that necessary services are started or stopped in the correct sequence.Understanding each stage of the Linux boot process—from hardware initialization and boot loader execution to service management—helps with debugging, system optimization, and customization. Mastery of these concepts is crucial for effective system management and troubleshooting.
The chain of events from when our machine turns on until the login prompt appears on the screen is the Linux boot process. Every step plays an important role in preparing the system ready for operation. Ensure that the correct software is loaded into memory, the hardware is initialized, and the services are started to establish an operational computer environment. Understanding these steps improves the process of debugging and customizing system behavior.
The following are the high-level stages of a typical Linux boot process:
Let’s have a look into each of these steps in detail:
When a computer is turned on, the BIOS (Basic Input/Output System) is the first point of interaction. Its primary responsibilities are initializing hardware components and performing system integrity checks. During the boot process, BIOS searches for the boot loader software, which loads the operating system into memory. The BIOS gives up control and lets the boot loader take over after the program has been found and put into memory. In short, BIOS makes it easier to load and run the CBR boot loader, which starts the operating system’s boot process.
Note: Linux uses the term master boot record (MBR); we will use coordinator boot record (CBR).
The coordinator boot record (CBR) is a crucial component of the boot process. It resides in the first sector of the bootable disk, typically located at /dev/hda
or /dev/sda
. With a size of less than 512 bytes, the CBR consists of three main components:
The primary boot loader info in the first 446 bytes
Partition table info in the next 64 bytes
CBR validation check in the last 2 bytes
One of its key functions is to contain information about the GRUB boot loader. The CBR’s primary role is to load and execute the GRUB boot loader, thus initiating the operating system’s loading process.
GRUB (Grand unified boot loader) is crucial to the Linux boot process. It allows users to select from multiple kernel images during startup. If no selection is made, it loads the default kernel image specified in its configuration file. Unlike its predecessor, GRUB understands filesystems. The configuration file, generally located at /boot/grub/grub.conf
, specifies boot parameters and settings, including entries for kernel and initrd
(initial ramdisk) images. In short, GRUB’s leading role is to load and execute the kernel and initrd
images, providing a smooth startup of the Linux system.
The kernel is a core component of the Linux operating system that performs critical tasks during the boot process. During the boot process, the kernel mounts the root file system specified in grub.conf
and executes the /sbin/init
program, which is assigned the initrd
provides temporary storage and essential drivers until the primary root file system is mounted. On the user side, the Coordinator Boot Record (CBR) is a small sector at the disk’s start, containing crucial boot loader information to initiate the boot process. In simple terms, the Coordinator Boot Record(CBR) loads and executes the GRUB boot loader.
During the boot process, the init system determines the Linux run level based on the configuration file /etc/inittab
. Various run levels are available, each with specific purposes, such as halting the system, entering the single-user mode, or launching full multiuser mode with graphical interface support. Init identifies the default run level from /etc/inittab
and loads all appropriate programs accordingly. While it’s possible to set the default run level to 0 or 6 for halting or rebooting the system, it’s generally advised against, as these actions can cause unintended consequences. Typically, administrators run levels 3 or 5, providing multiuser mode without a graphical interface and full multiuser mode with a graphical interface.
Linux executes various services from specific directories during startup based on the default run level setting. These directories, like /etc/rc.d/rc3.d/
for run-level 3, contain programs prefixed with “S” for startup and “K” for shutdown. Each program has a sequence number indicating its order of execution. For example, S12syslog
starts the Syslog daemon before S80sendmail
starts the sendmail daemon. This ensures that essential services start in the correct order to meet dependencies during system startup.
Understanding the intricacies of the Linux boot process, from BIOS initialization to service execution in various run levels, is essential for troubleshooting and customizing system behavior effectively.
Test your knowledge from the quiz below.
What is the first step in the Linux boot process?
The kernel loads the root file system.
BIOS initializes hardware and searches for the boot loader.
GRUB loads the kernel.
The init process executes system services.
In conclusion, understanding the Linux boot process—from BIOS initialization to service execution at different run levels—is essential for effective system management. Each stage plays a critical role in preparing the system for operation, ensuring that hardware is initialized, the operating system is loaded, and services are started in the correct order. Familiarity with these steps not only aids in debugging and troubleshooting but also provides valuable insights for optimizing and customizing the boot process according to specific needs.
Haven’t found what you were looking for? Contact Us
Free Resources