Sub topic 3
Boot the installer: UEFI versus BIOS
This chapter assumes you can use a Linux shell, know what a partition table is, and have an installation image that you verified in the previous chapter. It covers how the firmware starts the installer and why the mode you boot in decides how the installed system boots.
Why the boot mode matters
Firmware is the code stored on the motherboard. It runs first when you power on a machine, and it finds and starts a boot loader. Two kinds exist.
- BIOS (also called legacy or CSM mode) reads the first 512-byte sector of a disk, the Master Boot Record (MBR), and runs the code in it.
- UEFI reads boot entries stored in the machine's NVRAM and runs an
.efiprogram from a small FAT-formatted partition called the EFI System Partition (ESP).
The installer copies its boot loader to wherever the firmware will look for it. If the installer boots in BIOS mode, it installs a BIOS-style loader. If it boots in UEFI mode, it installs a UEFI-style loader. You cannot switch later by changing a setting. If you change the firmware mode after installing, the machine usually fails to boot, and the usual fix is to reinstall.
Differences that affect an install
| Aspect | BIOS | UEFI |
|---|---|---|
| Partition table | MBR (limit 2 TiB per disk, 4 primary partitions) or GPT | GPT (MBR is possible but uncommon) |
| Boot loader location | MBR and the gap before the first partition | `.efi` file on the ESP |
| Extra partition needed | BIOS boot partition (about 1 MiB) if using GPT | ESP (commonly 512 MiB to 1 GiB, FAT32) |
| Boot entries | One loader per disk | Several entries, managed with `efibootmgr` |
| Secure Boot | Not available | Available |
GPT is the GUID Partition Table. It is the modern partition format and the default for UEFI. A BIOS machine can also boot from a GPT disk, but GRUB then needs a tiny unformatted "BIOS boot" partition to store its code. Most installers create it for you when they detect BIOS mode with a GPT disk.
Prepare bootable media
Write the verified ISO to a USB stick. On Linux, dd does this. It overwrites the target without asking, so identify the device first.
# Find the USB stick: look at SIZE and MODEL, not just the name
lsblk -o NAME,SIZE,MODEL,TRAN
# Replace /dev/sdX with the whole device (not a partition such as /dev/sdX1)
sudo dd if=debian-netinst.iso of=/dev/sdX bs=4M status=progress conv=fsync
syncFor a virtual machine, attach the ISO as a virtual CD drive instead. For a cloud server, you usually skip this step. The provider boots the machine from its own image or a rescue ISO.
Choose the mode at boot
Press the firmware's boot-menu key at power-on. Common keys are F12, F10, F11, F8, Esc, or Del. Check your vendor's documentation. Many machines list the same USB stick twice.
- An entry labeled
UEFI: <device>boots the installer in UEFI mode. - An entry with only the device name boots it in BIOS (legacy) mode.
Choose the UEFI entry on any hardware made in about the last decade, unless you have a reason not to. Use BIOS mode only for old hardware, or for a virtual machine template that requires it.
In virtual machines, the setting lives in the VM configuration, not in a menu you see at boot:
- KVM/libvirt with OVMF firmware, VirtualBox with "Enable EFI", and Hyper-V Generation 2 give you UEFI.
- Hyper-V Generation 1 and the default SeaBIOS in QEMU give you BIOS.
Confirm the mode from the installer
Most installers have a text console. On Debian, press Ctrl+Alt+F2. On Ubuntu Server, choose the shell option from the Help menu. Run this check.
if [ -d /sys/firmware/efi ]; then
echo "Booted in UEFI mode"
else
echo "Booted in BIOS mode"
fiThe directory /sys/firmware/efi exists only when the kernel was started by UEFI firmware. If the result is not what you intended, reboot, pick the other boot entry, and run the check again before you partition anything.
Secure Boot
Secure Boot is a UEFI feature. The firmware only runs boot loaders signed by a trusted key. Debian, Ubuntu, RHEL, Rocky, and Alma ship a signed first-stage loader called shim, so their installers work with Secure Boot enabled.
The common problem is out-of-tree kernel modules, such as NVIDIA drivers or ZFS. Under Secure Boot the kernel rejects unsigned modules. You must either sign them and enroll the key through the Machine Owner Key (MOK) process, or disable Secure Boot. After installation, check the state with a tool from the mokutil package.
mokutil --sb-stateOutput such as SecureBoot enabled confirms the setting. Keep it on for servers unless a specific driver forces you to turn it off.
Check the result after installing
After the first boot, confirm that the installed system matches the mode you chose.
# UEFI install: the ESP should be mounted and boot entries should exist
findmnt /boot/efi
sudo efibootmgr -v
# Either mode: show partition table type and filesystems
lsblk -f
sudo parted -l | grep -i "partition table"On a UEFI install, findmnt /boot/efi shows a vfat partition, and efibootmgr lists an entry such as debian, ubuntu, or Rocky Linux. On a BIOS install, /boot/efi is absent and efibootmgr reports that EFI variables are not supported.
Common errors
- "No bootable device" after install. The firmware is looking in a different mode from the one you installed in. Switch the firmware's boot mode setting, or boot entry, to match what
lsblk -fshows. - Installer offers only MBR or fails to create an ESP. You probably booted the stick in BIOS mode. Reboot and choose the
UEFI:entry. - The USB stick is not listed at all. Check that Secure Boot is not blocking an unsigned image, that the stick was written with
ddrather than copied as files, and that the firmware is not set to disable USB boot. - Boot entry disappears after a firmware reset. UEFI stores entries in NVRAM, and a reset can clear them. The fallback path
EFI/BOOT/BOOTX64.EFIon the ESP lets the firmware find the loader anyway. Re-add the entry withefibootmgror by reinstalling the loader. - Disk larger than 2 TiB under BIOS with MBR. MBR cannot address the extra space. Use GPT with a BIOS boot partition, or move to UEFI.
Exercise
You install a server from a USB stick that you booted using the entry without a "UEFI:" prefix. The machine has UEFI firmware. After installation you switch the firmware to UEFI-only mode and the machine shows "No bootable device". Why, and how would you check what mode the installer ran in on a future install?
Show answer
The installer ran in BIOS (legacy) mode, so it wrote a BIOS-style boot loader to the MBR, or a BIOS boot partition on GPT, and created no ESP or UEFI boot entry. UEFI-only firmware looks for an .efi loader on an ESP, finds none, and reports no bootable device. On a future install, pick the "UEFI:" boot entry. Then open the installer's shell and check whether /sys/firmware/efi exists. If it does, the installer is in UEFI mode.