UEFI boot mode and Secure Boot on a host

Video 098 of 140 in Virtualization Foundations, in the unit “Firmware settings that matter on a virtualization host”. 2:46, with English and Hindi audio.

Before Linux starts, the firmware must find something to run. A host can boot in the older BIOS mode or in the newer UEFI mode, and with Secure Boot it can check that what it runs is trusted. This article explains the two boot modes, why the newer partition table matters, what Secure Boot checks, and how to read the boot mode and the Secure Boot state from Linux.

What you will learn

Two ways to boot: BIOS and UEFI

Long ago, a PC booted through the BIOS. It read the first sector of the disk, called the master boot record, and ran the code it found there. The old partition table, called MBR, cannot describe disks bigger than two terabytes. That limit pushed the industry to a newer table, called GPT.

UEFI is the newer firmware. It reads the GPT table, and it loads boot programs from a small EFI partition on the disk.

What Secure Boot checks

Picture the firmware as a guard at the door. Secure Boot is its checklist: only programs with a trusted signature may run. A signed boot loader passes the check, and the firmware starts it. The boot loader then starts the Linux kernel, and the kernel is checked the same way.

Suppose someone changed the boot loader. Its signature no longer matches, so the firmware blocks it.

Choices for a host at Harbor Point

Check the boot mode and Secure Boot from Linux

Linux checks the boot mode by looking for the efi folder in the firmware area of the system files. If the folder is there, the host booted in UEFI mode, and the test prints UEFI.

Show the boot mode
[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

The mokutil tool reports whether Secure Boot is on.

Show the Secure Boot state
mokutil --sb-state

Note: On a minimal image, mokutil may need to be installed first.

Check the boot mode and Secure Boot

You need a Linux host with a shell. On a minimal image, install mokutil before the second step.

  1. Check whether the host booted in UEFI mode or the older BIOS mode.

    [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

    What you should see: The test prints UEFI when the efi folder exists. The example output shows UEFI.

  2. Report whether Secure Boot is on.

    mokutil --sb-state

    What you should see: The mokutil tool reports the Secure Boot state. The example output shows SecureBoot enabled.

Terms

UEFI
The newer firmware that boots a host. It reads the GPT partition table and loads boot programs from an EFI partition.
Secure Boot
A firmware check that lets only boot programs and drivers with a trusted signature run.
GPT
The newer disk partition table, which UEFI reads, and which handles disks larger than two terabytes.

Check yourself

What limit pushed the industry from MBR to GPT?

The old MBR table cannot describe disks bigger than two terabytes.

What does Secure Boot check?

Each program in the boot path, such as the boot loader and the kernel, must carry a trusted signature. A changed program is blocked.

What does the efi folder tell you?

If the folder exists, the host booted in UEFI mode, and the boot mode check prints UEFI.

Previous: NUMA and sub-NUMA settings in firmware. Next: Checking firmware settings from Linux.