|
| 1 | +--- |
| 2 | +title: Secure Boot |
| 3 | +description: How to enable and use Secure Boot with AxOS. |
| 4 | +--- |
| 5 | + |
| 6 | +Secure Boot is a security feature that helps ensure that your device boots using only software that is trusted by the Original Equipment Manufacturer (OEM). AxOS doesn't natively support Secure Boot, but you can enable it's support. |
| 7 | + |
| 8 | +This guide walks you through enabling **Secure Boot** with **TPM support** on AxOS using `sbctl` and `GRUB`. |
| 9 | + |
| 10 | +## Install `sbctl` |
| 11 | + |
| 12 | +`sbctl` (Secure Boot Control) is a tool to manage Secure Boot keys and sign EFI binaries. |
| 13 | + |
| 14 | +```bash |
| 15 | +epsi i sbctl |
| 16 | +``` |
| 17 | + |
| 18 | +*Tip: You can check its version with `sbctl --version` to ensure the installation worked.* |
| 19 | + |
| 20 | +## Enter Setup Mode in UEFI |
| 21 | + |
| 22 | +Reboot into your BIOS/UEFI firmware and **enable Setup Mode**. |
| 23 | +This disables Secure Boot temporarily, allowing you to register your own custom keys later. |
| 24 | + |
| 25 | +> 💡 In most BIOS interfaces, you’ll find this under: |
| 26 | +> Security → Secure Boot → Set Secure Boot Mode → Custom / Setup Mode |
| 27 | +
|
| 28 | +## Create Secure Boot Keys |
| 29 | + |
| 30 | +Use sbctl to generate your custom Secure Boot keys. |
| 31 | +These consist of the **PK (Platform Key)**, **KEK (Key Exchange Key)**, and **db (Signature Database)**. |
| 32 | + |
| 33 | +```bash |
| 34 | +sudo sbctl create-keys |
| 35 | +``` |
| 36 | + |
| 37 | +## Enroll Microsoft Keys (Optional but Recommended) |
| 38 | + |
| 39 | +If you dual-boot with Windows, you’ll need to enroll Microsoft’s keys. |
| 40 | +Otherwise, Windows will refuse to boot under Secure Boot. |
| 41 | + |
| 42 | +```bash |
| 43 | +sudo sbctl enroll-keys -m |
| 44 | +``` |
| 45 | + |
| 46 | +- The `-m` flag tells `sbctl` to also import **Microsoft’s KEK and db keys**. |
| 47 | + |
| 48 | +## Sign the Linux Kernel |
| 49 | + |
| 50 | +Now you need to sign your Linux kernel so the firmware recognizes it as trusted. |
| 51 | + |
| 52 | +```bash |
| 53 | +sudo sbctl sign -s /boot/vmlinuz-linux |
| 54 | +``` |
| 55 | + |
| 56 | +⚙️ If you use a different kernel (like linux-zen, linux-lts, or a custom one), replace the path accordingly. |
| 57 | + |
| 58 | +## Install GRUB with TPM & Secure Boot Support |
| 59 | + |
| 60 | +Reinstall GRUB with TPM modules enabled and shim lock disabled (since sbctl handles signing). |
| 61 | + |
| 62 | +```bash |
| 63 | +sudo grub-install \ |
| 64 | + --target=x86_64-efi \ |
| 65 | + --efi-directory=/boot/efi \ |
| 66 | + --bootloader-id=AxOS \ |
| 67 | + --disable-shim-lock \ |
| 68 | + --modules="tpm" |
| 69 | +``` |
| 70 | + |
| 71 | +- The `--modules="tpm"` flag ensures GRUB supports the Trusted Platform Module for measured boot. |
| 72 | +- The `--disable-shim-lock` is important. We’re using our own keys, not the Microsoft “shim” loader. |
| 73 | + |
| 74 | +## Regenerate the GRUB Configuration |
| 75 | + |
| 76 | +Once GRUB is installed, regenerate its configuration file to include all detected boot entries. |
| 77 | + |
| 78 | +```bash |
| 79 | +sudo grub-mkconfig -o /boot/grub/grub.cfg |
| 80 | +``` |
| 81 | + |
| 82 | +Check for errors, you should see lines mentioning your kernel and initramfs being found. |
| 83 | + |
| 84 | +## Sign GRUB and Boot Files |
| 85 | + |
| 86 | +Finally, sign all EFI executables used during boot. |
| 87 | +This includes your GRUB binary and any distribution-specific bootloaders. |
| 88 | + |
| 89 | +```bash |
| 90 | +sudo sbctl sign -s /boot/efi/EFI/AxOS/grubx64.efi |
| 91 | +sudo sbctl sign -s /boot/efi/EFI/BOOT/BOOTX64.EFI |
| 92 | +sudo sbctl sign -s /boot/efi/EFI/GRUB/grubx64.efi |
| 93 | +``` |
| 94 | + |
| 95 | +## Final Checks |
| 96 | + |
| 97 | +1. Verify all files: |
| 98 | + ```bash |
| 99 | + sudo sbctl verify |
| 100 | + ``` |
| 101 | +2. Reboot and enter UEFI settings again. |
| 102 | +3. **Enable Secure Boot**. |
| 103 | +4. Save and exit. |
| 104 | + |
| 105 | +If everything was done correctly, your system should boot into AxOS with Secure Boot enabled! |
| 106 | + |
| 107 | +If you get a black screen or signature error, don’t panic. You can disable Secure Boot temporarily, boot into Linux, and recheck which EFI binaries weren’t signed. |
| 108 | + |
0 commit comments