Secure Boot is a security standard developed by the PC industry to help ensure that a device boots using only software that is trusted by the Original Equipment Manufacturer (OEM). To achieve this on Linux, you must use a distribution that includes a signed bootloader (typically signed by the Microsoft Third-Party UEFI CA) or manually enroll your own keys into the UEFI firmware. This prevents unsigned code, such as rootkits or unauthorized operating systems, from executing during the boot process, thereby hardening the system against pre-boot attacks.
What You'll Need
- A PC with UEFI firmware (most computers made after 2012).
- A Linux distribution that supports Secure Boot (e.g., Ubuntu, Fedora, openSUSE, or Debian).
- A USB drive for installation.
- Administrative access to the BIOS/UEFI settings.
- A backup of your important data before modifying firmware settings.
Step-by-Step
- Verify UEFI Mode: Before starting, ensure your system is booting in UEFI mode rather than Legacy/BIOS mode. You can check this in your current OS or by entering the firmware settings. Secure Boot cannot function in Legacy mode.
- Enter UEFI Firmware Settings: Restart your computer and press the designated key (usually F2, F12, Del, or Esc) to enter the UEFI/BIOS menu. Note that labels and menu paths can differ slightly by version, device, or region.
- Enable Secure Boot: Navigate to the Security or Boot tab and locate the Secure Boot setting. Change the status to Enabled. If the option is greyed out, you may need to set a Supervisor Password in the Security tab first.
- Select the Correct Secure Boot Mode: If your firmware offers a choice between "Windows UEFI mode" and "Other OS," choose "Windows UEFI mode" for distributions like Ubuntu or Fedora, as they use the Microsoft Third-Party CA key. Choose "Other OS" if you intend to enroll your own custom keys.
- Install the Linux Distribution: Boot from your installation media. During the installation process, the installer will detect Secure Boot. For distributions like Ubuntu, the system will automatically set up the "shim" bootloader, which is a small piece of signed code that then verifies and loads the actual GRUB bootloader.
- Configure MOK (Machine Owner Key): If you install third-party drivers (such as NVIDIA proprietary drivers or specific Wi-Fi drivers), the system will prompt you to create a MOK. This is necessary because these drivers are kernel modules that must be signed to load under Secure Boot. Follow the prompts to create a password for the MOK enrollment.
- Enroll the Key at Reboot: Restart the computer. Instead of booting directly into Linux, you will see a blue screen titled "Perform MOK management." Select "Enroll MOK," then "Continue," and then "Yes." Enter the password you created during the installation.
- Confirm and Boot: Once the key is enrolled, select "Reboot." The system will now boot into Linux with Secure Boot fully active, and your third-party drivers will be permitted to load.
- Verify Status in Linux: Open a terminal and run the command
bootctl statusormokutil --sb-state. The output should explicitly state "Secure Boot enabled."
Common Mistakes
One of the most frequent errors is forgetting to interact with the MOK (Machine Owner Key) blue screen during the first reboot after installing proprietary drivers. Many users assume the screen is a system error or a hang and force-restart the computer. If you skip this step, the kernel will refuse to load the unsigned modules, resulting in a failure to load graphics drivers (dropping you to a low-resolution screen) or a total loss of Wi-Fi connectivity.
Another common mistake is attempting to use a "minimal" or "community" spin of a distribution that does not include the shim bootloader. While the main version of a distro might support Secure Boot, some specialized versions do not ship with the necessary signatures, leading to a "Security Violation" error immediately upon booting.
Users also frequently confuse "Fast Boot" with "Secure Boot." Fast Boot is a Windows feature that hibernates the kernel to speed up startup; it does not provide security. In fact, Fast Boot can sometimes interfere with the ability to access UEFI settings or boot from a USB drive, so it should be disabled in Windows before attempting a Linux installation.
Tips
If you are an advanced user who wants total control, consider "User Mode" in your UEFI settings. This allows you to delete the default OEM keys and install your own private keys. This is the gold standard for security, as it ensures that only binaries signed by you can boot, removing trust from Microsoft and the hardware vendor entirely.
When using distributions like Debian, be aware that Secure Boot support is available but may require more manual configuration than in Ubuntu or Fedora. Always check the specific distribution's wiki regarding "shim-signed" packages to ensure you have the necessary components installed.
Keep a recovery USB drive that is known to be Secure Boot compatible. If you accidentally corrupt your bootloader or misconfigure your keys, having a signed live environment allows you to boot back into the system to repair the GRUB configuration without having to disable security features in the BIOS.
Troubleshooting
If the system fails to boot and displays a "Secure Boot Violation" or "Invalid Signature" error, the first step is to enter the UEFI settings and verify that Secure Boot is enabled and the correct mode is selected. If the error persists, try disabling Secure Boot temporarily to confirm that the OS is installed correctly and that the issue is strictly related to the signature verification.
If you are in Linux but your NVIDIA drivers aren't working despite enabling Secure Boot, use the command mokutil --import /var/lib/shim-signed/mok/MOK.der (path may vary by distro) to manually trigger the key enrollment process. After running this, restart and follow the MOK management prompts on the blue screen.
If you cannot access the MOK management screen at all, you may need to clear the Secure Boot keys in the UEFI settings (Reset to Setup Mode) and then re-enable them. This forces the firmware to re-examine the signatures on the boot disk. Warning: resetting keys may require you to re-enroll your MOK passwords.
In cases where the system hangs at a black screen during boot with Secure Boot on, check if you have "Secure Boot Custom Mode" enabled. If you haven't provided your own keys, ensure this is set to "Standard Mode" so the system uses the factory-installed Microsoft and OEM keys.
Frequently Asked Questions
Does Secure Boot slow down the boot process?
No, the performance impact is negligible. The firmware simply performs a cryptographic check of the bootloader signature before executing it, which takes a fraction of a second.
Can I dual-boot Windows and Linux with Secure Boot?
Yes. Since most major Linux distributions use the Microsoft Third-Party UEFI CA signature for their shim bootloader, both Windows and Linux can coexist and boot securely on the same machine.
Will Secure Boot prevent me from using a custom kernel?
Yes, unless you sign the custom kernel yourself. If you compile your own kernel, you must generate a private key, sign the kernel image, and enroll the corresponding public key into the MOK list.
Do I have to disable Secure Boot to install Linux?
Not for supported distributions. While some older guides suggest disabling it to avoid errors, modern installers for Ubuntu, Fedora, and openSUSE are designed to work with Secure Boot enabled from the start.
What happens if I lose my MOK password?
You will not be able to enroll new keys through the MOK menu. You will need to boot with Secure Boot disabled, use mokutil --reset to clear the password, and then re-enable Secure Boot to set a new one.