Linux Boot Process Explained
Understand how Boot Managers work in Linux
Any PC computer when powered on starts a series of complex hardware test actions programmed by a special memory called BIOS.
This memory has the function of starting the machine, recognizing the installed devices and loading the operating system.
During boot, BIOS performs a series of tests, whose function is to accurately determine the hardware components installed in the system. This test is called POST (power-on self test).
It is through POST that the computer searches for information about the numbers and types of boards, CD-ROM drives, HDs, serial, parallel and USB ports, monitor, mouse, keyboard, etc.
Right after the hardware tests, BIOS searches in hard disk devices and CD-ROM for a special address called the boot sector.
On motherboards that adopt the EFI or UEFI system, the operating system loading process involves reading a special boot file from a file system on a special partition called EFI System Partition (ESP).
This special partition uses the FAT (File Allocation Table) format. In Linux it is typically mounted at /boot/efi.
This scheme used by EFI is more complex than in BIOS, allowing each operating system installed on the computer to have its own separate boot loader system.
That way, EFI has a "boot manager" that allows the user to choose which boot loader system they want to start when turning on the computer.
For this EFI "boot manager" system to work, the boot loader systems must be properly registered in the firmware through EFI's own utility or through the efibootmgr program in Linux.
Kernel Loading Process
Depending on the type of disk used, the boot sector, or loader sector, is located in a specific location with a specific signature defined by industry standards.
It is in the boot sector that operating systems write the software responsible for starting the operating system loading.
That way, BIOS or motherboard firmware searches in the disk's boot sector for the boot manager.
In Linux the most common boot managers are GRUB and GRUB 2. They are responsible for loading the Kernel into memory.
During kernel loading, Linux loads a special file system called initramfs, which contains a minimalist version of the file system, so that the init process (the parent of all processes in Linux) can be loaded.
This allows several tasks to be executed before the real file system is loaded.
After the Kernel is loaded, it starts a special process called init (for SystemV-based systems) or systemd (for Systemd-based systems).
Both init or systemd are the parent of all processes and responsible for the rest of the Linux boot loading.
After boot loading, init calls another special program called getty, which is responsible for user authentication and starting the shell process.
See how Grub works in Linux:
Learn much more about Linux in our online course. You can enroll here with a 7-day free trial. If you already have an account, you can access it here.
Liked it? Share :-)
That was just one piece. The course teaches the whole path — from your first command to exam day.