Part II · Your system
20.1 From firmware to init
alsoboot sequenceboot processbootloaderinitramfsinitrduefibiossecure boot
TL;DR
- The firmware (UEFI or BIOS) checks the hardware and starts a bootloader from disk.
- The bootloader (GRUB, systemd-boot) loads the kernel and the initramfs into RAM.
- The kernel uses the initramfs to find and mount the real root filesystem, then starts init: process 1.
- Init (systemd on most distros) starts services until it reaches the default target.
systemd-analyze # time spent in each stage
systemd-analyze blame # slowest services first
journalctl -b -1 # logs of the previous boot
On your machine
$ atfq 20.1 Firmware UEFI · Secure Boot on Kernel 6.12.48-amd64 Cmdline BOOT_IMAGE=/vmlinuz-6.12.48-amd64 root=UUID=3f1c2a9e-8b7d-4e21-9c55-0a6b2d7e9f10 ro rootflags=subvol=@ quiet splash Init systemd · default target graphical.target Loader systemd-boot 256.4 · 1 unified kernel image(s) Up 3 days, 4 h
An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.
Pitfalls
journalctl -b -1needs a persistent journal (/var/log/journalexists). Otherwise the logs of earlier boots are gone.- With Secure Boot on, only signed bootloaders, kernels and modules load: a module built on your machine (NVIDIA through DKMS, for one) has to be signed with a key you enroll.
- A broken initramfs drops you into an emergency shell before root is
mounted. Rebuild it from a live USB with your distro's tool:
update-initramfs,dracutormkinitcpio.
Deep dive 2 questions
What is the initramfs for?
The kernel can't carry drivers for every disk controller, RAID, LVM or encryption setup. The initramfs is a small archive, loaded next to the kernel, with just enough tools to reach the real root: unlock a LUKS disk, assemble a RAID, mount the filesystem. Then it hands over to the real init.
UEFI or BIOS?
A BIOS runs the 446 bytes of code at the start of the first disk, which
then loads the rest of the bootloader. UEFI reads files from the EFI System
Partition, a small FAT partition often mounted at /boot/efi or /efi,
and keeps its boot entries in firmware memory: efibootmgr lists them.
UEFI is also what makes Secure Boot possible.