The journey from powering on a Linux system to a fully operational state involves a complex sequence of stages.
Let's break down the Linux boot process into four crucial phases:
BIOS POST
Boot Loader (GRUB2)
Kernel Initialization
Init Process managed by systemd
1. BIOS POST (Power On Self Test):
The initial stage, BIOS POST, has very little to do with Linux itself but plays a pivotal role in the overall boot sequence.
BIOS conducts a 'Power On Self Test' to ensure the hardware components connected to the device are functioning correctly. Any failure during this test may render the computer inoperable.
2. Boot Loader (GRUB2):
Following the POST, the Boot Loader, often GRUB2 (Grand Unified Bootloader version 2), takes charge.
Located in the first sector of the hard disk (in the /Boot file system for Linux), the Boot Loader loads and executes boot code. It presents users with a boot screen, offering multiple options.
Once a selection is made, the Boot Loader loads the selected kernel into memory, provides necessary parameters, and hands over control to the kernel.
3. Kernel Initialization:
The loaded kernel, usually in a compressed state to conserve space, undergoes decompression during this phase.
The kernel is then loaded into memory and starts execution. Tasks performed by the kernel include hardware initialization and memory management. Once operational, the kernel seeks an init process to run, setting up user space and processes essential for the user environment.
4. Init Process (systemd):
In most modern Linux distributions, the init process hands over control to the systemd daemon. systemd plays a critical role in bringing the Linux host to a usable state. It is responsible for tasks such as mounting file systems and starting and managing system services.
Notably, systemd has replaced the older System V init system, reducing system startup time through parallelization of service startups.
Checking the Init System:
To determine the init system used on a Linux system -
ls -l /sbin/init
If systemd manages the system, the pointer will be directed towards ---> /lib/systemd/systemd
.