<aside> ๐งญ
Module 05 ยท Boot and init โ from firmware to systemd
This is the last module in the Foundation tier, and it is here on purpose. Booting looks like a beginner topic, but explaining it honestly needs PID 1, mounts, and signal handling โ all of which you now have.
๐ง concept โ ๐งฉ real-world analogy โ ๐งช exercise โ โ expected result (hidden) โ ๐ฏ interview questions (hidden)
</aside>
<aside> โ
Before you start, you should already know:
From Module 01 โ kernel versus user space, device drivers, and how to read /proc and /sys.
From Module 02 โ what PID 1 is and why it is special.
From Module 03 โ mounts, mount points, and how one filesystem hides another.
From Module 04 โ signals, TERM versus KILL, and graceful shutdown.
Everything in this module is read-only or reversible. Nothing here will stop your lab booting โ but do it on the lab VM anyway, not on a machine you care about.
</aside>
<aside> ๐
Official docs: bootup(7) โ the whole boot sequence ยท Kernel admin guide ยท The kernel's command-line parameters
</aside>
When you press the power button, there is no operating system. There is no filesystem, no driver, and nothing in memory. The CPU has to start executing something, and that something has to be in a fixed place it can find without help.
That is the firmware: code stored on a chip on the motherboard. Its job is small and specific:
Then it is finished. Firmware does not stay resident and does not manage anything.
There are two kinds, and which one you have changes almost everything about the next step.
| BIOS (legacy) | UEFI (modern) | |
|---|---|---|
| How it finds the boot code | Reads the first 512 bytes of a disk โ the master boot record โ and runs it. | Reads a real filesystem (a FAT partition, the ESP) and runs a named .efi file. |
| How much room the boot code has | 446 bytes. Genuinely. | As much as it likes. It is an ordinary file. |
| Boot entries | None. There is one MBR. | A list stored in NVRAM on the motherboard, editable with efibootmgr. |
| Signature checking | No. | Yes โ Secure Boot. |
That 446-byte figure is the reason GRUB exists in the shape it does. You cannot fit a bootloader in 446 bytes, so on BIOS systems it is split into stages: a tiny first stage whose only job is to find and load a bigger second stage.
<aside> ๐งฉ
Real-world analogy โ a relay race
Booting is a relay. Four runners, and each one's only real job is to hand the baton to the next.
execing the real init.The useful part of the picture is what happens at each handover: the first two runners stop. Firmware is not sitting underneath your running system supervising things. It handed over and finished. This is why "the BIOS is causing my performance problem" is almost always wrong โ by the time Linux is up, the firmware has not executed an instruction in minutes.
Where the analogy stops working. Real runners all run the same kind of leg. Here, each stage is written in a different style, with different capabilities, and the handovers are where boot problems live. Nearly every boot failure you will debug happens at a handover โ not in the middle of a leg.
</aside>
๐งช Exercise A1.1 โ Find out which firmware booted this machine
# The one-command answer: if this directory exists, you booted with UEFI
[ -d /sys/firmware/efi ] && echo "UEFI" || echo "BIOS (legacy)"
# On UEFI, the firmware keeps a boot menu in NVRAM
if command -v efibootmgr >/dev/null && [ -d /sys/firmware/efi ]; then
sudo efibootmgr -v | head -8
else
echo "(efibootmgr not installed, or BIOS boot)"
fi
# The EFI System Partition is an ordinary FAT filesystem - Module 03 applies
findmnt /boot/efi 2>/dev/null || echo "(no ESP mounted)"
# What is actually on it?
sudo find /boot/efi -name '*.efi' 2>/dev/null | head -5