Skip to content

Linux Foundations / Understand the system underneath ยท Step 26 of 38

Lesson: Boot Process OverviewSwitch
โ† Linux Foundations

System administration

Boot Process Overview

Follow a Linux machine from the power button to a login prompt in four stages.

When you press the power button, no operating system is running yet. A chain of programs starts, and each one does just enough to load the next. Knowing the chain tells you where to look when a machine will not start.

The four stages

  1. Firmware (BIOS or UEFI) is stored on the motherboard. It checks the hardware and finds something to boot.
  2. Bootloader (usually GRUB 2 on PCs and servers) loads the Linux kernel into memory.
  3. Kernel sets up the processor, memory and drivers, then mounts the root filesystem.
  4. Init is the first user space process. It starts services and, finally, the login prompt.

Embedded boards, virtual machines and containers can skip or replace some stages. A container, for example, does not boot its own kernel at all.

Where the handoffs happen

The firmware knows nothing about Linux in particular. It only knows how to start a boot program from a disk, a USB stick or the network.

The bootloader does know where the kernel is. It also loads an initial RAM filesystem (initramfs), a small temporary filesystem that helps the kernel reach the real disk.

The kernel then runs one program, init, as process ID 1. Everything else in user space is started by it, directly or indirectly.

Looking at your own boot

You can see traces of each stage on a running system. First, check how the firmware started the machine. This directory exists only after a UEFI boot:

$ ls -d /sys/firmware/efi
/sys/firmware/efi

Next, see the line the bootloader handed to the kernel:

$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-6.8.0-45-generic root=UUID=1b2c... ro quiet

Finally, ask which program is process 1:

$ ps -p 1 -o comm=
systemd

Most current distributions answer systemd. Some, such as Alpine, use a different init.

On systemd machines, journalctl -b shows the log of the current boot. You may need sudo to see all of it.

Using the stages to troubleshoot

Work out the last thing that succeeded. No picture at all points to hardware or firmware. A grub> prompt means the bootloader started but could not continue on its own. A kernel panic means the kernel was running. A system that boots but has one dead service is an init-level problem.

Try it

Run the three commands above on a Linux machine or virtual machine. Write down your firmware type, your kernel file name and the name of process 1. You can practise looking at processes in the processes lab.

Check your understanding

Boot Process Overview

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.