Skip to main content

Linux Boot Process

The below image outlines the typical flow of a Linux system boot.

image.png

------------------------------------------------------------------------------------------------------------------------------------------------====================================================================================

BIOS (Basic Input/Output System) & UEFI (Unified Extensible Firmware Interface)

BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface) are both firmware interfaces that provide a critical layer between your hardware and operating system during the startup process. However, they differ significantly in their functionality and capabilities.

Similarities:

  • Both BIOS and UEFI are pre-installed on your motherboard and activate when you turn on your computer.
  • They perform essential tasks like initializing hardware components, performing power-on self-tests (POST), and loading the operating system from a storage device.

------------------------------------------------------------------------------------------------------------------------------------------------====================================================================================

MBR - master boot record  & GPT - GUID partition table

MBR (Master Boot Record) and GPT (GUID Partition Table) are both partition table formats used on hard disk drives (HDDs) and solid-state drives (SSDs) to define how the storage space is organized. However, they have some key differences:

Similarities:

  • Both MBR and GPT are located at the beginning of a storage device and define how the storage space is divided into partitions.
  • They both store information about each partition, such as its size, file system type, and location on the disk.
  • Both allow you to create multiple partitions on a single storage device, enabling you to manage different operating systems or data types more efficiently.
  • Identification of boot loader (typically at beginning of disk) - Once identified, the boot process is handled by the boot loader - most commonly GRUB2.

Note; MBR is an older standard of partitioning, most systems will now use GUID.

------------------------------------------------------------------------------------------------------------------------------------------------====================================================================================

GRUB2 (Grand Unified Boot Loader)

GRUB2 is a software program, specifically a bootloader. Its primary function is to take control during the computer startup process after the firmware (BIOS or UEFI) has initialized the hardware. Here's a breakdown of its role:

  • Loading the Operating System Kernel: GRUB2 locates the kernel (the core program) of your operating system on the storage device. It then loads this kernel into memory.
  • starts kernel and systemd.

====================================================================================

Initrd & Kernel

------------------------------------------------------------------------------------------------------------------------------------------------

InitrdWhat &is Kernelinitrd?

initrd

(initialisation

WhichRAM filedisk) is essentially a set of instructions used to load the kernel. initrd is stored temporarily in /bootsystem ismemory the kernel?

Typically,whilst the kernel file itself (located within /boot) is prefaced with 'vmlinuz', for example:

vmlinuz-5.15.0-106-generic

 

 loaded.

------------------------------------------------------------------------------------------------------------------------------------------------

What is a Linux Kernel?

------------------------------------------------------------------------------------------------------------------------------------------------

Which file in /boot is the kernel?

Typically, the kernel file itself (located within /boot) is prefaced with 'vmlinuz', for example:

vmlinuz-5.15.0-106-generic

Working on Linux systems, you may see systems with various kernels installed.

Which file in /boot is initrd?

The initrd file will be prefaced with just that - initrd:

initrd.img-5.15.0-106-generic

------------------------------------------------------------------------------------------------------------------------------------------------

To check which kernel is currently being treated as the primary one (which will be loaded on boot), you can check the symlinks (in /boot), as below:

vmlinuz -> vmlinuz-5.15.0-107-generic

vmlinuz.old -> vmlinuz-5.15.0-106-generic

The same applies to the initrd files:

initrd.img -> initrd.img-5.15.0-107-generic

initrd.img.old -> initrd.img-5.15.0-106-generic

------------------------------------------------------------------------------------------------------------------------------------------------

====================================================================================

Systemd

Systemd is the first process that starts on a booting OS. 

------------------------------------------------------------------------------------------------------------------------------------------------