Fixing a machine that does not boot, or a driver that does not load, requires knowing each stage.
Booting happens in stages, and each hands control to the next:
- Firmware (UEFI, or legacy BIOS) initialises hardware and starts a bootloader from the EFI system partition.
- The bootloader (GRUB, or systemd-boot) loads the kernel image and the initramfs from
/bootand passes the kernel command line (/proc/cmdlineshows it afterwards), e.g.root=UUID=... ro quiet. - The kernel initialises devices and mounts the initramfs, a small temporary root filesystem holding the drivers and tools needed to find the real root (RAID, LVM, encryption, network root).
- The initramfs mounts the real root filesystem and executes systemd as PID 1, which starts units in parallel until the default target is reached (
multi-user.targetfor servers,graphical.targetfor desktops).
systemd-analyze, blame and critical-chain show where boot time goes. For rescue, edit the kernel line in the bootloader to add systemd.unit=rescue.target or emergency.target.
Much of the kernel is built as loadable modules (drivers, filesystems, netfilter features) in /lib/modules/$(uname -r). lsmod lists loaded ones, modinfo describes one, modprobe name loads it with its dependencies (-r removes). Modules usually load automatically when hardware appears; persist manual ones in /etc/modules-load.d/, set options in /etc/modprobe.d/, and blacklist unwanted drivers there too. After changes that affect early boot, regenerate the initramfs (update-initramfs -u or dracut -f).
Example
systemd-analyze # Startup finished in 2.1s (kernel) + 6.4s (userspace)
systemd-analyze blame | head -n 5 # slowest units
systemd-analyze critical-chain # what the boot actually waited for
cat /proc/cmdline # BOOT_IMAGE=/vmlinuz-6.12... root=UUID=... ro quiet
systemctl get-default # multi-user.target
uname -r; ls /boot # running kernel vs installed kernels and initramfs
lsmod | head -n 5 # loaded modules, sizes, users
modinfo -F description ext4 # Fourth Extended Filesystem
sudo modprobe br_netfilter # load a module and its dependencies
echo br_netfilter | sudo tee /etc/modules-load.d/k8s.conf # load at every boot
echo 'blacklist nouveau' | sudo tee /etc/modprobe.d/no-nouveau.conf
sudo update-initramfs -u # Debian/Ubuntu (dracut -f on Fedora/RHEL)Remember
- Firmware -> bootloader -> kernel + initramfs -> systemd -> default target
- systemd-analyze blame / critical-chain explain slow boots
- modprobe loads modules; persist in /etc/modules-load.d, configure in /etc/modprobe.d
Watch out for
- Changing storage drivers or encryption setup without regenerating the initramfs, leaving a system that cannot find its root.