My notes on setting up secure boot on Debian in 2026. These are not meant to be a coherent write-up, just a bunch of notes I learned during my 5 days spend setting up secure boot
My mountpoint is for ESP is /boot/efi most tools default to this path, and they also check if the partition is mounted.
I like to set noauto here sometimes, depending on what am I trying to achieve. This results in /boot/efi not being mounted.
Most package install scripts will fail silently here if it's not mounted, causing a headache.
MOK keys are just stored in the nvram, but uefi does not seem to do anything with it by itself. All MOK infrastructure seems to be implemented in shim-signed instead.
MOK Manager is one of these things. Some writeups refer to it as begin "invoked by the firmware" or write about it being a firmware thing, but that's wrong. MOK is implemented in shim-signed.
So to launch MOM Manager, shim has to be launched first! Also to pass along MOK keys and mok state to systemd-bootd, and thus the OS, the system HAS TO BE launched by shim.
Kernel is signed by debian. That's cool. But it wouldn't validate our initramfs... which is a security gap. Anyone could put some onion-spicy in the initramfs and it would go unnoticed. Therefore we must sign inintramfs, and all the other stuff loaded at booting, like microcode.
UKI bundles all this up to a single EFI PE binary which can be signed by MOK (or the complicated thing described below) so initramfs will be validated as well.
The following flow just works:
firmware -> shim-signed -> systemd-bootd -> Debian UKI
That's because the firmware with it's default Microsoft keys will be able to validate shim-signed. Which embeds Debian's keys, which is used to sign systemd-bootd which loads our OS. systemd-bootd does validate our os, but if it uses MOK, it requires shim to pass the MOK stuff to it.
Seems like they forgot to mention this to systemd-bootd as for some reason it always attempts to override to boot entries and the boot order, so it gets loaded instead for shim, and it fails to do so... idk the reason for that.
It seems like there are two ways to veify stuff that you are loading
- Some complicated magic, with a lot of keys and stuff (
- MOK
The first one is used by UEFI to verify what it loads. By default those are the Microsoft keys, that also valid for shim-signed.
On some systems (Lenovo ThinkPads for example) these can be replaced by any other key, and use that to sign your bootloader/kernel. This way shim is not actually needed, because UEFI will trust the bootloader.
But this is tedious and not that greatly documented (altrough Arch Wiki done it).
MOK is easier to setup, it's just a simple RSA keypair that can be generated by openssl, but it requires shim to be present in the boot chain.
If you trust Microsoft keys, anyone can walk up to your computer and load Microsoft signed stuff on it, like shim, with their own config, grub, and an official debian image. And even replace what's in there with signed stuff.
To avoid this, Microsoft keys must be replaced with the complicated stuff. So only stuff that you specifically signed can be loaded on the machine.
At this point, setting a bios password would also be a must have, otherwise anyone could disable secure boot, reset Microsoft's keys, etc. Must be cautious with this, because forgetting the supervisor possword would also mean locking yourself out permanently, and potentially soft-bricking the device (some laptops have very involved way of resetting the password, like sending it in to the manufacturer)
- https://www.freedesktop.org/software/systemd/man/latest/ukify.html Systemd ukify manual
- https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html Systemd stub manual
- https://www.freedesktop.org/software/systemd/man/latest/systemd-boot.html Systemd boot manual
- https://wiki.debian.org/UKI UKI - Debian Wiki
- https://wiki.debian.org/SecureBoot SecureBoot - Debian Wiki
- https://wiki.debian.org/UEFI UEFI - Debian Wiki
- https://wiki.gentoo.org/wiki/Unified_kernel_image UKI - Gentoo Wiki
- https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot Unified Extensible Firmware Interface/Secure Boot - Arch Wiki
- https://blog.bofh.it/debian/id_465 I replaced grub with systemd-boot - Blog of Marco d'Itri.
- https://manpages.debian.org/unstable/systemd-boot/systemd-boot.7.en.html manual of systemd-bootd
- https://copyninja.in/blog/enable_secureboot_ukify.html Note to Self: Enabling Secure Boot with UKI on Debian - Blog of Copyninja
- https://copyninja.in/blog/enable_ukify_debian.html Note to Self: Enabling Unified Kernel Image on Debian - Blog of Copyninja
- https://github.com/stezzbruh/Debian-Secure-Boot Debian Secure Boot - stezzbruh
- https://github.com/rhboot/shim Shim source code
- rhboot/shim#608 (about options.csv, which I ended up not needing afterall)
- rhboot/shim#692 Unable to enable MokListTrusted (--trust-mok) - GitHub issue
- https://packages.debian.org/forky/shim-signed shim-signed package on Debian
- https://bbs.archlinux.org/viewtopic.php?id=291995 [SOLVED] UKI and Secure Boot with kernel-install... - Arch BBS
- https://bbs.archlinux.org/viewtopic.php?id=293365 shim + systemd-boot - Arch BBS
- https://github.com/Xdavius/debian-sb-kernel-signing Debian/Ubuntu UEFI Secure Boot with Mainline/Custom Kernels - berglh, Xdavius
- https://old.reddit.com/r/archlinux/comments/1bwyz0i/uki_unified_kernel_image_and_directly_booting_it/ UKI (Unified Kernel Image) and directly booting it, is there any benefit? - Reddit
- https://makedebianfunagainandlearnhowtodoothercoolstufftoo.computer/doku.php?id=start:issecurebootworking issecurebootworking
- https://superuser.com/questions/906989/using-shim-with-debian Using Shim with Debian - Super User
- https://www.reddit.com/r/archlinux/comments/xcp05l/install_arch_linux_with_self_signed_keys/ Install arch linux with self signed keys - Reddit
- https://forum.manjaro.org/t/enabling-secure-boot-with-shim-signed-but-i-cant-install-it/104851 Enabling Secure Boot with shim-signed but I cant install it - Manjaro Forum
- https://anarc.at/blog/2025-08-20-luks-ukify-conversion/ Encrypting a Debian install with UKI - Blog of Anarcat
- https://uapi-group.org/specifications/specs/boot_loader_specification/ UAPI boot spec