Skip to main content

Command Palette

Search for a command to run...

Case Study: Linux Boot Process — From BIOS to systemd

It is a case study that explains the Linux boot process from BIOS to sytemd.

Updated
3 min read
Case Study: Linux Boot Process — From BIOS to systemd
R

Welcome to my personal informative blog, where knowledge thrives! Here we can embrace the power of knowledge to bring a positive change.

Objectives

  • Understand each step of the Linux Boot process

  • Understand the role of GRUB, initramfs, and systemd in the boot process

  • Getting some experience in solving boot-related issues in Linux

System Environment


  • OS: Ubuntu 22.04

  • Boot Mode: UEFI

  • Init System: systemd

  • Filesystem: ext4

  • Kernel: 5.x

UEFI/BIOS


It has some specific functions:

  • It initiates three hardware components, namely RAM, CPU, and disks.

  • It also locates the bootloader on the disk.

Observation:

On UEFI systems, the bootloader is loaded from

/boot/efi/EFI/ubuntu/grubx64.efi

Bootloader == GRUB


It serves the following purposes:

  • Provides a boot menu to select an OS.

  • It loads the Linux kernel and initramfs. Then, passes kernel parameters.

Important Files are:

/boot/grub/grub.cfg
/etc/default/grub

Linux kernel initialization


The kernel has some steps to fulfil, like:

  • Hardware detection

  • It mounts the temporary root file system

  • Starts the init process

Command to check the kernel version:

uname -r

Command to see kernel logs:

dmesg | less

initramfs


What is initramfs?

  • It is a compressed temporary filesystem.

  • It is loaded into RAM.

  • It consists of drivers and scripts for detecting the disks and mounting the real root file system.

  • The location of this file is :

/boot/initrd.img-*
  • Now, the command to inspect the content of the initramfs file is:
ls initramfs /boot/initrd.img-$(uname -r) | less
  • Its significance lies in the fact that if the file is missing or corrupted, then the boot process will fail. Secondly, the "root filesystem not found" error is related to this file.

systemd


  • systemd plays an important role as it starts all system services and manages targets and dependencies.

  • Command to see systemd status:

systemctl status
  • Command to see boot targets:
systemclt list-units --type=target

Boot performance analysis


  • Command to analyze boot time:
systemd-analyze
  • Command to see a detailed breakdown
systemd-analyze blame
  • Command to see a visual graph of boot performance
systemd-analyze plot > boot.svg

Troubleshooting Case Scenarios


Case: Boot hangs at GRUB

Reason: Corrupted GRUB file

Solution:

sudo update-grub

Recovery Mode


  • Methods to access recovery mode:

-> Hold Shift (BIOS)

-> Press Esc (UEFI)

  • Reasons to access recovery mode:

-> Filesystem repair

-> Network Repair

-> Root shell access

Conclusion


By understanding the boot process in Linux systems, we can have:

-> faster troubleshooting

-> better system optimization

-> safe kernel and system updates

In technical terms:

  • initramfs is critical for disk and driver support.

  • GRUB misconfiguration is a common reason for boot failure.

  • systemd-analyze is significant for performance tuning.

So, in this case study, we can see the steps involved in the Linux boot process and conclude that failure of any step can result in boot failure.