From firmware to bootloader: UEFI and GRUB
What happens between power-on and the kernel: BIOS versus UEFI, the EFI system partition, Secure Boot with shim, regenerating GRUB's config, and systemd-boot.
From firmware to bootloader: UEFI and GRUB
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Firmware's job is to find and start a bootloader. Legacy BIOS runs code from the first sector of a disk. UEFI reads a FAT-formatted EFI System Partition and runs a .efi program named in its boot entries.
- Under Secure Boot the firmware only runs signed code. Linux distributions boot through shim, a small loader signed by Microsoft that embeds the distribution's own key, which in turn signs GRUB and the kernel.
- Never hand-edit grub.cfg. Edit /etc/default/grub (or /etc/grub.d/) and regenerate: update-grub on Debian and Ubuntu, grub2-mkconfig on the Red Hat family, where grubby edits per-kernel entries.
- systemd-boot is a simpler UEFI-only alternative that reads plain entry files from the ESP instead of generating a script.
- Microsoft's 2011 UEFI CA, the root that signed shim for years, expired in June 2026. Existing signed binaries keep booting, but new shims are signed by the 2023 CA, so old firmware may need its key database updated.
The chicken-and-egg problem
When you press the power button, memory is empty. The kernel is a file on a disk, and reading files needs a filesystem driver, which is part of the kernel. Something has to bridge that gap with almost no help. The answer is a relay of small programs, each one just smart enough to load the next: firmware, then a bootloader, then the kernel. This lesson covers the first two legs. The next lesson picks up when the kernel starts.
You need this the day a server does not come back after an update. Knowing which leg failed tells you which tool to reach for.
Legacy BIOS
On older PCs, firmware called the BIOS ran a power-on self test, then read the first 512-byte sector of the boot disk, the Master Boot Record, and jumped into it. 446 bytes is not enough to understand a filesystem, so the bootloader had to be squeezed in stages into hidden gaps on the disk. It worked for decades and it is still what many virtual machines emulate by default, but it limits disks to MBR partitioning and gives no way to verify what it runs.
UEFI and the EFI System Partition
UEFI replaced that with a small operating environment of its own. It understands one filesystem, FAT, and expects an EFI System Partition (ESP): a FAT-formatted partition, typically a few hundred megabytes, holding .efi programs. The firmware keeps a list of boot entries in its own memory, each pointing to a file on an ESP, and runs the first one that works. On Linux, efibootmgr lists and edits those entries.
Linux mounts the ESP so packages can update the files on it. The systemd-boot(7) man page lists the usual mount points as /efi/, /boot/, or /boot/efi/. Debian and the Red Hat family typically use /boot/efi.
Secure Boot and shim
UEFI can refuse to run anything not signed by a key in its database. The Debian wiki puts it plainly: “Most x86 hardware comes from the factory pre-loaded with Microsoft keys.” So a Linux bootloader must be signed by Microsoft or the user must disable Secure Boot.
Asking Microsoft to sign every GRUB and kernel build would not scale. The solution is shim: a tiny, audited first-stage loader that Microsoft signs once, which embeds the distribution’s own CA key. The firmware trusts shim. Shim trusts anything signed with the distribution’s key, such as GRUB and the kernel. Debian has booted this way since Debian 10. Users can add their own Machine Owner Keys (MOK) to shim’s list with mokutil, and the wiki notes the enrolment must be confirmed at the console during the next boot, so malware in user space cannot do it silently. That matters for out-of-tree kernel modules, which come up in the modules lesson.
On Debian 13 the signed binaries ship as files like /usr/lib/shim/shimx64.efi.signed and /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed. I read those paths from the package file lists on packages.debian.org. grub-install copies them onto the ESP.
A 2026 change to know about. The Microsoft Corporation UEFI CA 2011, the root that has signed shim for Linux since the start, expired on 27 June 2026. The Debian wiki’s CA changes page explains that firmware is not expected to enforce certificate dates for these signatures, so existing signed binaries keep booting. But new shims can only be signed with the “Microsoft UEFI CA 2023”, and older machines whose firmware lacks that CA will need a firmware or key-database update before they trust them. Some 2024-and-later machines ship only the 2023 CA and reject older install media. Debian has published dual-signed shims for 12 and 13.
GRUB: a generated config
GRUB 2 is the bootloader on most servers. It shows the menu, can edit the kernel command line at boot, and loads the kernel and initramfs. Its menu comes from grub.cfg, which is a generated shell-like script that you should never edit by hand. The GRUB manual describes the intended flow: grub-mkconfig “will discover available kernels and attempt to generate menu entries for them”, driven by /etc/default/grub and the scripts in /etc/grub.d/.
Debian’s shipped /etc/default/grub, from the grub2 source package (version 2.12-9+deb13u4), contains these active lines. The @...@ placeholders are filled in at build time:
GRUB_DEFAULT=0
GRUB_TIMEOUT=@DEFAULT_TIMEOUT@
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="@DEFAULT_CMDLINE@"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=true
Edit the file, then regenerate:
- Debian and Ubuntu:
sudo update-grub. The script in Debian’s source is three lines and ends inexec grub-mkconfig -o /boot/grub/grub.cfg "$@". - Fedora and RHEL:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg. These distributions also keep one Boot Loader Specification file per kernel in/boot/loader/entries/, andgrubbyis the supported tool for changing a kernel’s arguments, for examplegrubby --update-kernel=ALL --args=....
Use GRUB_CMDLINE_LINUX for arguments every entry needs, and GRUB_CMDLINE_LINUX_DEFAULT for ones only the normal entry should get. The manual explains that the default variant is added only to the default entry, not to the recovery entry.
systemd-boot
systemd-boot is the minimalist alternative. The man page calls it “a simple UEFI boot manager” that supports “UEFI firmware only”. There is no generated script: each menu entry is a small text file on the ESP or an extended boot partition, and bootctl installs and inspects it. Arch users and some Fedora variants use it. On a typical Debian or RHEL server you will meet GRUB.
About the video
The embed is Joe Collins’s “How Linux Boots”, November 2025, clipped from “Hardware testing and bootloading” through “BIOS vs UEFI boot methods” (about 19 minutes). Collins walks the firmware stage, configuring the GRUB menu, and the BIOS and UEFI differences on a real system. I judged this from the chapter list and description, and have not checked how much it says about shim, so Secure Boot and the 2026 CA expiry come from this lesson’s prose. systemd-boot is not covered in the clip. English was judged from the title, channel and original English audio track. Later chapters of the same video are linked from the next two lessons.
What was run: nothing on Linux. The default GRUB file and update-grub were read from Debian’s source archive, the shim and GRUB paths from Debian’s package file lists, and the rest comes from the GRUB manual (2.16), systemd-boot(7) and the Debian wiki, checked 2026-11-28.
Check yourself
You add a kernel parameter to GRUB_CMDLINE_LINUX in /etc/default/grub and reboot, but it is not on the kernel command line. What did you forget?
To regenerate grub.cfg, with update-grub on Debian/Ubuntu or grub2-mkconfig on the Red Hat family. GRUB reads the generated file, not /etc/default/grub.
Why does a Debian machine with Secure Boot on need a binary signed by Microsoft?
Most PC firmware ships trusting only Microsoft's keys. Shim is signed by Microsoft and carries Debian's key, so the firmware trusts shim and shim trusts the Debian-signed GRUB and kernel.
What is on the EFI System Partition and what filesystem is it?
It is a FAT-formatted partition holding the bootloaders and related EFI programs, such as shim and GRUB, that the firmware can run.
A Secure Boot machine refuses to boot an older Debian install image with a security violation, though Windows boots fine. What is a likely cause on 2024 or newer hardware?
The firmware may only trust the new 'Windows UEFI CA 2023' and not the 2011 Microsoft UEFI CA that signed that shim. Updated shims are signed with the 2023 CA, or the old CA can be enabled or added in firmware setup.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.