theme: ricetheme
New palette
New palette

UEFI Secure Boot Explained: Keys, Signing, and Trust

UEFI Secure Boot checks boot signatures before code runs. See how its key chain and custom keys affect dual boot and unsigned driver failures at startup.

A diagram showing a secure boot process with a trusted key, bootloader, and kernel connected by green links, while an unsigned block is rejected.

tl;dr the short answer

UEFI Secure Boot is a firmware feature that checks digital signatures on boot programs before allowing them to run, blocking code signed by untrusted keys or listed as revoked. In practice, trusted keys must cover each stage of the boot chain, and Linux users may need to sign kernels or drivers and enroll their own keys; distro and device steps vary. Keeping it enabled can help prevent tampered boot code from loading, but careless key changes or unsigned files can stop a system from booting.

Think of a bouncer who checks every ID before anyone gets past the velvet rope. UEFI (Unified Extensible Firmware Interface), the firmware that starts your machine before Linux, has one called Secure Boot.

It makes each boot program prove its signature before it runs.

Simply put, Secure Boot runs only signed, trusted boot code, so a tampered bootloader doesn’t get a free pass.

We’ll cover the key chain, enrolling and signing your own keys, turning it on or off, and the Linux fixes that are easy to miss: distro differences, dual booting, and unsigned driver or kernel breakage.

What UEFI Secure Boot Is and Does

Secure Boot is a feature of UEFI (Unified Extensible Firmware Interface), the firmware that starts your machine before your operating system loads.

It replaced the legacy BIOS (Basic Input/Output System), and the big difference is that BIOS simply ran whatever it found, while UEFI can verify code first.

How it checks and blocks boot code

Each boot file can carry a digital signature: a cryptographic stamp showing who signed it and that it hasn’t changed. If the signature matches a key the firmware trusts, the code runs. If not, it’s blocked. Nothing gets a free pass.

This check runs during the pre-boot process, before Windows, Linux, or malware can load. Secure Boot doesn’t encrypt anything, but it complements disk encryption by confirming the code that unlocks your drive hasn’t been swapped.

Consider a Linux user dual booting Arch beside Windows. If an unsigned boot file shows up in the boot partition, Secure Boot blocks it, so the boot stops at a known checkpoint instead of loading something unknown.

Platforms and Linux distros it runs on

  • Ubuntu’s support history. Ubuntu has a long Secure Boot track record, making its setup a common reference point.
  • amd64 and arm64 shims. A shim is a small, signed loader that lets Linux start under Secure Boot. Shims come in amd64 (standard 64-bit PCs) and arm64 (64-bit ARM) versions.
  • Microsoft certificates in firmware. Microsoft’s certificates are stored in firmware, which is why signed Linux shims can boot on ordinary PCs.
  • Arch setup focus. This guide centers on Arch, where you handle more of the setup yourself, so we’ll focus there.
  • NVIDIA Jetson implementation. Jetson boards handle Secure Boot their own way, so treat the general steps here as a starting point.

How the Boot Chain Stays Trusted

Secure Boot is a chain of trust: each link checks the next. It cares about who signed a file, not what it does.

Each Ubuntu boot step in order

  1. Boot variables and BootOrder. Boot variables live in firmware, and BootOrder sets which entry it tries first.
  2. Firmware validates shim. It checks shim, a small signed loader, against keys the firmware trusts.
  3. shim loads GRUB or MokManager. Shim checks GRUB, the bootloader. New keys go through MokManager, where you add them to your Machine Owner Key (MOK) list.
  4. GRUB validates the signed kernel. GRUB checks the kernel’s signature before booting it.
  5. Boot halts on failed validation. A single failed check stops the boot. Nothing gets a free pass.

Checking the kernel and its modules

With Secure Boot on, the kernel rejects unsigned modules, but Ubuntu’s Canonical-signed modules load fine.

Custom modules need signing. Say you’re a tinkerer with a homemade wifi driver: sign it, enroll your key through MOK, and your wifi works on every boot. Skip that, and the kernel won’t load it.

The initrd, a small temporary filesystem used early in boot, isn’t validated by Secure Boot. That’s a real gap.

Fedora, Debian, and Arch differ in how much they sign for you, so check your distro’s docs.

What a strong trust setup looks like

  • Unified kernel image: one signed file bundling kernel, initrd, and boot options, covering the initrd.
  • Own keys over defaults: enroll keys you control, not just vendor ones.
  • Full drive encryption: keeps your data safe if the disk is stolen.
  • Optional TPM use: a Trusted Platform Module (TPM) can withhold disk keys once the boot chain changes.
  • BootROM root-of-trust (Jetson): on NVIDIA Jetson boards, the BootROM (read-only code in the chip) is the first link everything checks against.

Diagram showing secure boot chain from BootROM to encrypted disk, with a failed alternative path in red.

The Keys and Lists That Decide Trust

Secure Boot is only as trustworthy as its lists, so here’s how they stack.

Key layers from PK down to dbx

At the top sits the Platform Key (PK), and only one PK is allowed.

The Key Exchange Key (KEK) signs updates to the signature database (db), which lists the keys allowed to boot, and to the revocation database (dbx), which lists revoked (no longer trusted) entries.

So the KEK controls changes to trust, while db and dbx decide what boots.

Keys from vendors and third parties

Your firmware already holds Microsoft’s DB and KEK certificates. Many Linux installs depend on the Canonical key in shim (shim is a small signed loader).

Hardware makers (OEMs, or original equipment manufacturers) add their own OEM keys, and add-in cards bring their own firmware in the form of option ROMs (OpROMs). When a key gets compromised, a revocation list file adds it to dbx.

Signing your own modules with MOK keys

Some drivers are signed by nobody on those lists. That’s where your own Machine Owner Key (MOK) comes in: a machine-specific module signing key for one computer’s kernel modules.

A module-signing-only key usage OID (an object identifier, or tag) restricts it to that one job. You enroll it through MokManager, a small boot-time tool.

The catch: the private key is root-readable, so anyone with root access can sign with it. That’s the tradeoff.

DKMS (Dynamic Kernel Module Support) can generate MOK keys automatically for the modules it builds. Signing the NVIDIA driver is a prime case of this. Picture a student on a ten-year-old ThinkPad who installs it through DKMS.

Once she enrolls the key, the driver loads with Secure Boot still on. Her laptop stays protected. Her graphics work.

Getting Ready and Checking Your Status

Before you change anything, you need to know where you stand. Here’s how to get in, check, and prepare.

How to open your firmware setup

Your UEFI (Unified Extensible Firmware Interface, the layer that starts your machine before Linux loads) setup screen usually opens from a key tapped at startup: Esc, F2, or Del. You can also reboot from Windows settings into it.

Sometimes an admin password is required. To enroll your own keys, clear the Platform Key (PK) to enter Setup Mode, where new keys can be added.

Checking whether Secure Boot is on

Picture a Fedora user on a Windows laptop who checks first, so they don’t chase the wrong fix. Work through these, top to bottom:

  • bootctl status shows the Secure Boot state.
  • efivar (a tool for reading UEFI variables) reads the raw SecureBoot value.
  • mokutil --sb-state gives a quick yes or no.
  • Kernel log messages from your current boot should agree.
  • sbctl status summarizes the setup, then you can inspect the enrolled PK, Key Exchange Key (KEK), and db (the signature database).

Confirm what’s enabled rather than guess. If the tools disagree, treat it as a clue, not a crisis.

What to install and back up first

Install efitools (tools for building key lists), openssl (for creating keys and certificates), and sbsigntools (for signing the boot files your firmware runs). Back up the existing variables first.

Check whether any add-in cards, like a graphics card, carry a signed OpROM (option ROM, the firmware those cards load at boot), since unsigned ones can break. Finally, make sure your installation media supports Secure Boot.

A rescue stick that won’t boot is just a coaster.

Making Your Own Signing Keys

Making your own keys means you decide who the firmware trusts. Here’s what to create and which helpers save time.

Creating key pairs and certificates

You’ll need Secure Boot keys, and openssl is the usual tool for making them. A self-signed certificate is signed with its own key, which is fine for personal use.

The Platform Key (PK) controls who can change the other keys, the Key Exchange Key (KEK) authorizes changes to the allowed-signature list, and the db key pair signs your boot files.

Each key gets a GUID, generated with a tool like uuidgen, to tag its entries.

Keep demo and production certs apart. A homelab tinkerer on a spare box can use a throwaway demo cert. On a laptop you carry everywhere, the certificate can be shared, but the private key is what you guard.

Which file formats each key uses

Mixing these up is an easy trap:

  • PEM: text-based keys and certs, the format openssl writes.
  • DER .cer: binary certs that firmware usually expects at enrollment.
  • .esl (EFI signature list): a bundle of certs or hashes, made with cert-to-efi-sig-list.
  • .auth (signed update): a signed .esl, made with sign-efi-sig-list, that changes firmware key databases.

The .esl is the list, but only the signed .auth gets accepted when you change firmware keys.

Helper tools for generating keys

Three helpers cover most of this:

  • sbctl create-keys: makes a full PK, KEK, and db set in one command.
  • ukify genkey: generates signing keys for unified kernel images.
  • Rod Smith’s mkkeys script: builds the key set and the .auth files for enrollment.

A self-hoster rebuilding a custom kernel on a home server only re-signs each new build with the same key, so the firmware keeps trusting it. Set it up once.

A flat illustration shows a home server, terminal commands for key generation, and a reusable amber key icon securing kernel build cards.

Turning on Secure Boot and Adding Keys

Secure Boot only trusts keys the firmware already holds, so load yours first.

Different ways to load your keys

Your board decides which route fits:

  • Flash-time keys: the --uefi-keys option loads your keys as the board flashes.
  • Capsule update: a firmware update package applied at reboot, which can carry key changes.
  • efi-updatevar: writes key lists into firmware variables from a running Linux system.
  • sbkeysync: syncs key files from a folder into the key databases.
  • Firmware setup utility: the settings menu where you clear keys or enroll them from files.
  • KeyTool or systemd-boot: KeyTool adds keys by hand from an EFI app, while systemd-boot can enroll them itself.

Common mistakes and the right order

Order matters. Watch these four traps:

  • Enroll PK last. The Platform Key (PK) ends setup mode, where keys can be written freely, so load your Key Exchange Key (KEK) and signature database (db) first.
  • User Mode after PK. Enrolling PK moves the firmware into User Mode, where changes need a PK signature. Plan edits before that.
  • Immutable efivars. Firmware variables are flagged immutable so stray deletes can’t wipe them. Clear the flag with chattr -i before writing.
  • Locked BIOS passwords. An admin password can block the setup menu, so have it ready before enrolling.

Letting tools enroll keys for you

Picture a Linux user installing a proprietary NVIDIA driver. On reboot, MokManager asks them to trust its key.

  • sbctl enroll-keys: loads your keys with sbctl, a Secure Boot key manager. Keep Microsoft’s keys if you dual boot Windows.
  • systemd-boot auto-enroll: with keys on the EFI system partition and the firmware in setup mode, it enrolls them on next boot.
  • MokManager Enroll MOK: the Machine Owner Key (MOK) trusts your own signed modules. Pick Enroll MOK, enter your password, and reboot, and the driver loads with Secure Boot still on.

NVIDIA Jetson steps for Thor and Orin

  1. Key config file: list your keys in the file the flash tools read.
  2. gen_uefi_keys_dts.sh DTBO: run it to turn those keys into a device tree binary overlay (DTBO).
  3. Per-device flash commands: each board gets its own, so run the one for your module.
  4. Thor versus Orin differences: the two don’t share one recipe. Check your module first.

Signing the Parts That Boot Up

Every link in the chain needs a valid signature, so here’s what to sign, how, and where to put it.

What files need a signature

Secure Boot doesn’t stop at the bootloader. It covers everything the boot path loads:

  • Bootloader: the first EFI (Extensible Firmware Interface) program that runs.
  • Kernel image: the Linux kernel file itself.
  • Unified kernel image: one EFI file bundling the kernel, initrd (initial RAM disk), and boot options.
  • initrd and extlinux.conf: the RAM disk and the extlinux.conf boot menu.
  • Kernel-dtb and recovery images: the device tree blob (kernel-dtb) some boards need, and recovery images.
  • Third-party EFI tools: extra EFI programs you copy onto the ESP (EFI System Partition).

Commands that sign each boot file

Several tools can sign them:

  • sbsign and sbverify: sbsign signs an EFI file, and sbverify checks it.
  • openssl cms signing: a lower-level route using OpenSSL’s CMS (Cryptographic Message Syntax) feature.
  • sbctl sign: signs with keys sbctl manages for you.
  • systemd-sbsign: systemd’s own signing helper.
  • Signature appended 4KB-aligned: the signature sits at the end, padded to a 4KB boundary, so signed files come out slightly larger.

Run sbverify before you reboot.

Setting up signing to run automatically

Say you run Arch on a ThinkPad. A kernel update adds an unsigned file, and Secure Boot refuses to load it. A pacman hook (pacman is Arch’s package manager) signs it before you reboot, so the next boot just works.

  • sbctl pacman hook: signs new boot files after each update.
  • mkinitcpio post hook: signs the initrd after mkinitcpio rebuilds it.
  • sbupdate (outdated): it’s out of date, so treat guides that rely on it with caution.
  • DKMS auto-signing with MOK: DKMS (Dynamic Kernel Module Support) rebuilds out-of-tree kernel modules, signing them with a MOK (Machine Owner Key).
  • Re-sign after kernel updates: every new kernel means fresh files to sign.

Set it up once, and it stays signed.

Diagram showing an unsigned file passing through a hook to get signed, then booting on a laptop with a green checkmark.

Copying signed files to the right places

  • Copy to rootfs and ESP: place signed files in both the root filesystem and the ESP.
  • dd to partitions: dd writes raw bytes straight to a partition, and a typo in the target can wipe the wrong one.
  • Identify partitions with blkid: blkid lists partitions by label and filesystem type, so you can spot the ESP.

Check the target twice, then copy once.

Updating Keys and Blocking Revoked Ones

Trusted keys aren’t set in stone. Lists get new entries, and sometimes a key has to be cut off. Here’s how those changes work and how to confirm they took.

Updating the KEK, db and dbx lists

Each list is guarded by the one above it. The platform key (PK) signs changes to the Key Exchange Key (KEK), and the KEK signs changes to the signature database (db) and the forbidden signature database (dbx).

That’s why a random program can’t quietly rewrite your trust list.

For example, a Linux user who signs their own kernel with a personal key needs that key in db. Running efi-updatevar with -a adds the key and keeps everything already there, so the distro still boots.

Leave the flag out and it replaces the whole list, which can strip out the keys that distro’s boot software relies on.

Some firmware also accepts key updates as a capsule, a signed update package applied on the next boot. These usually arrive through the vendor’s update tooling, so you rarely touch them by hand.

Revoking keys and confirming the changes

Revocation happens through dbx. Anything listed there is blocked, even with a valid signature. That matters when a signing key leaks or a signed bootloader turns out to be flawed.

The lists also hold more than one entry. The KEK and db can each store several keys, so a distro’s key, a vendor’s key, and your own can be trusted side by side.

Use mokutil to check your changes. mokutil --sb-state confirms Secure Boot is still on, and mokutil --list-enrolled lists keys enrolled through MOK, the machine owner key list. Checking takes seconds. Fixing a boot failure doesn’t.

Is It Better to Enable or Disable Secure Boot?

Keep Secure Boot on unless you have a concrete reason to turn it off. The real choice is protection over convenience, and we’ll show when each side wins.

When a setup can brick your hardware

Secure Boot can check each option ROM (OpROM), the firmware a device like a GPU runs at boot. According to the paper Meeting NSA’s “Guidance for Managing UEFI Secure Boot”, Secure Boot can verify signed Option ROMs before allowing them to run.

Many are signed by Microsoft, so keeping the Microsoft and OEM keys is optional, but it’s the safer default.

Lenovo and ASUS reports describe machines that stopped booting after key changes, and Framework’s firmware verification adds another layer. Read the vendor notes first.

Keeping keys and firmware locked down

Set a strong firmware password so nobody can change settings. Guard your noPK.auth file, which removes the Platform Key (PK), the top key that anchors the rest. Don’t store keys on the ESP (EFI System Partition), which is easy to reach from any OS.

Think of a homelabber who keeps a MOK (Machine Owner Key) on a regular filesystem. It’s convenient, but it weakens security, since anyone who can read that folder can grab the signing key. A locked USB stick keeps that trust yours.

Turning Secure Boot off the right way

  • Disable in firmware. The clean route, and where most people should start.
  • mokutil —disable-validation. It tells shim to stop validating, which isn’t the same as turning Secure Boot off.
  • noPK.auth. Removing the Platform Key switches Secure Boot off.
  • Reset Secure Boot Keys. It restores the default keys, so it’s a reset, not a disable switch.

If the toggle won’t change, your firmware may be flash-enabled, which locks the setting. Dual booting with Windows? Check firmware changes before you flip them, because one can stop Windows from starting.

If a boot fails after an update, check Secure Boot first, since an unsigned module or changed key can block startup.

Secure Boot makes more sense once you see the whole chain: keys sign the boot software, the firmware checks those signatures, and each stage vouches for the next.

With that picture, enrolling your own keys, handling dual boot, and fixing unsigned driver or kernel breakage become steps you can work through instead of mysteries.

Keep the trusted and revoked key lists in mind whenever an update goes sideways, and you’ll know where to look. Secure Boot and a Linux setup you actually control can share the same machine, and now you know exactly how.

References

  1. Meeting NSA’s “Guidance for Managing UEFI Secure Boot” — dl.acm.org

Questions

What is the difference between UEFI and BIOS?

BIOS is the older firmware interface, which generally runs boot code without checking its signature. UEFI replaces BIOS and can verify boot programs against trusted keys before allowing them to run; Secure Boot is a UEFI feature that uses this capability.

How to enable UEFI Secure Boot?

Restart into your computer’s UEFI setup, usually by pressing Esc, F2, or Del during startup, then find and enable Secure Boot. The exact menu names vary by manufacturer, and the firmware must have suitable trusted keys enrolled; back up important data and check your operating system’s boot support before changing settings.

Is it better to enable or disable Secure Boot?

For most users, it is better to keep Secure Boot enabled because it blocks boot code that does not have a trusted signature. You may need to change keys or sign custom boot files and kernel modules, and a specific compatibility problem can be a reason to disable it temporarily.

Can Secure Boot be enabled while in user mode?

Yes. Secure Boot can be enabled in User Mode, which normally means a Platform Key is enrolled and firmware key changes require authorization. Ensure the boot files are signed by keys the firmware trusts before enabling it, or the system may not boot.

Sources

  1. Meeting NSA’s “Guidance for Managing UEFI Secure Boot”, dl.acm.org