- BIOS POST
- Boot Loader (GRUB2)
- Kernel Initialization
- Service Initialization
The Linux boot process can be initiated in one of two ways:
- Starting a Linux device that is currently halted.
- Rebooting or resetting a running system.
1. BIOS POST
The initial stage is the BIOS POST (Power-On Self-Test). During this phase, the BIOS performs thorough hardware checks to confirm that all components are functioning correctly. Since this stage is driven by the BIOS, it is largely independent of Linux. A failure during POST will prevent the system from moving to the subsequent stages.2. Boot Loader
Following a successful POST, the BIOS loads and executes the boot code from the designated boot device. Typically, this boot code is found in the first sector of the hard disk, and for Linux systems, within the/boot filesystem.
At this point, the boot loader displays a boot screen that may offer multiple options. For example, in a dual-boot scenario, you might choose between Microsoft Windows and Ubuntu 18.04. After selecting an option, the boot loader proceeds to load the Linux kernel into memory, passes the required parameters, and transfers control to the kernel.
A widely used boot loader is GRUB2 (Grand Unified Boot Loader Version 2), which has become the standard for most Linux distributions.
3. Kernel Initialization
Once the Linux kernel is loaded, it is typically stored in a compressed format, which is then decompressed and loaded into memory during this stage. The kernel then begins execution and performs several critical tasks, including hardware initialization and memory management. This process is essential for setting up the environment before user-space initialization. Below is a sample of typical kernel log output during initialization:4. Service Initialization
Modern Linux distributions typically use SYSTEMD as the INIT process, which is responsible for transitioning the system into a fully operational state. SYSTEMD takes charge of mounting file systems and managing system services. It has largely replaced the older SYSV-INIT (or SYS5), which was prevalent in older distributions such as RHEL6 and CentOS 6. One of the major benefits of SYSTEMD is its ability to parallelize the startup of services, significantly reducing the boot time. To verify which INIT system is in use, execute the following command to inspect the symbolic link for/sbin/init: