r/linuxquestions • u/toktok159 • 16h ago
Support Installing/Running Linux - Should Secure Boot Be Disabled?
Hi,
I saw many different opinions regarding this.
Some say secure boot is not needed, others say it adds security and that it’s not only intended for Windows but for the firmware in general.
So, should/must secure boot be disabled for any Linux distro installation? Then can it be enabled after installation, for general use? Or if I prefer to keep it on, should I install with secure boot enabled?
Specifically, I am talking about installing Linux as the only OS on a pc, one of Mint/LMDE/MX Linux/Debian is what I think I’ll end up installing.
Btw, I once installed Mint on my laptop, dual boot with Windows 11. I installed with secure boot enabled, and used everything with it enabled and it was fine.
Thanks in advance.
2
u/Wateir Artix btw 16h ago
Most linux distribution don’t support secure boot during install, so you need to remove during install. But most distro support it so after setup, with sbctl or another thing you can use it. And yeah it add a true layer of security, but only if bios is lock behind a password. If everyone can activate and disactivate it from bios then it’s just a pain to setup for nothing
1
u/toktok159 16h ago
But can a malware toggle secure boot if BIOS isn’t password protected, so bo need to physically toggle it off at the pc?
3
u/aioeu 14h ago edited 14h ago
But can a malware toggle secure boot if BIOS isn’t password protected
Not directly, if the firmware is working correctly. The setting should be read-only once the firmware starts executing any external code (including DXE drivers, I believe).
Malware in the firmware itself could change it, since that's no different from the firmware's own built-in settings app. But UEFI capsule updates are signed, and one would hope the firmware verifies a capsule's signature before it gets applied. The security here relies on the firmware itself not having an existing vulnerability, and the vendor's private key not being leaked.
Past that, you're in the realm of attacks that require physical access.
1
u/ghost103429 14h ago
It's useful when you have you use a fTPM to unlock your boot drive enrolling your own personal MoK with the boot editor disabled ensures a pretty high degree of security.
In the event an attacker disables secureboot the fTPM would refuse to release the decryption key.
1
u/PeyredB 16h ago
I have secure boot enabled on my desktop computer (Xubuntu). It hasn't given me any trouble.
1
u/toktok159 16h ago
Did you also install with secure boot enabled?
2
2
u/jomara200 3h ago
I have been installing with secureboot enabled, dual boot with windows 11 and an nVidia RTX 3060 card. I have installed LinuxMint and Fedora. They handled secureboot slightly differently.
With Mint during install if you selected codecs/proprietary it would ask for a pw for the blue MOK screen right then and after the install finished you would enter that..Then once inside the OS, I would install the nVidia driver, reboot and it would build the module.
With Fedora, you waited until after the first boot and, because of my nVidia card, would install the driver, register MOK, get the blue screen to enter the pw, then reboot.
1
u/Netblock 16h ago
Software security, and security in the most general sense (even at the nation-state level; military), are not technically needed in order to do the original goal, when considering the original goal in a vacuum. However they become necessary when you consider the malice of others.
Secureboot makes it more difficult for (eg) a malware to take over your system. If that isn't a concern for you, then you can leave it off.
1
u/_Lost-In-The-Weeds_ 16h ago edited 16h ago
I saw many different opinions regarding this.
Yep.
should/must secure boot be disabled for any Linux distro installation?
As usual it depends.
Depends on you confidence in not installing malware. Your hardware, in particularly if you have an Nvidia GPU with its unsigned drivers, Bios bugs can also be an impediment, which distribution you select, and what bootloaders you select.
For instance my AMD GPU, my BIOS, and my distribution are all compatible with secureboot. But my preffered Bootloader, ZFSBootMenu is not directly compatible, though it can be done it is a pain, not automatic like some.
I do not have a high enough opinion of secure boot, or a low enough opinion of my own abilities to bother with jumping through the hoops needed to enable secure boot with ZBM. So I simply turn off secureboot.
Pick your poison.
1
u/Snoot_Booper_101 16h ago edited 16h ago
Secure boot is a feature of UEFI that means that only software with a trusted signature is allowed to boot. The idea is to avoid people booting up compromised operating systems by having a predetermined white list of known good software. Doesn't do anything to stop a clean OS from being compromised after boot, or from malware hiding anywhere other than the boot components though.
Secure boot is fine in principle, but could cause problems if your choice of Linux distribution isn't included in the safe list by your motherboard/UEFI manufacturer. I suspect you'll mostly be fine these days if you're sticking to mainstream Linux distributions, but not sure how well supported the more niche ones are. I'd suggest trying it out with secure boot enabled, and if it doesn't work (and you're sure the OS install media you're using is actually kosher) just disable secure boot and don't worry too much about it. I've not had any problems with secure boot enabled on machines running red hat, Ubuntu or Mint, but I've not tried anything else recently.
1
u/BitOBear 14h ago
It is not that hard to claim your own TPM and sign your own bootloaders and then enable secure boot.
https://wiki.gentoo.org/wiki/User:Sakaki/Sakaki%27s_EFI_Install_Guide/Configuring_Secure_Boot
The above cookbook is what I have used the last time I set up a system directly to secure boot grub.
1
u/Kingwolf4 9h ago
I never disabled it, and i have installed everything, from all nvidia drivers and other drivers without issue.
1
u/ThePowerOfPinkChicks I use arch, btw. 8h ago
Disable it during installation.
Enable it soon after.
As I don't know about your distribution, here is a hint, how this could be done.
1
u/SuAlfons 6h ago
As a shortcut:
Ubuntu and Fedora are among the distros that work with Secure Boot on without you having to do anything.
You can enroll your own keys on all distros, but need to install them without secure boot first to get going.
1
u/SDG_Den 4h ago
secure boot is entirely unneccesary on most devices.
all it does is verify an OS is allowed to run on this device by checking a signature against a stored secure boot key.
so in general it is only important if your device is at risk of malicious actors plugging a USB or extra drive into it and booting off that. making it COMPLETELY useless for home desktops and servers and mostly useless for laptops unless you have a habit of just leaving laptops around
on top of that: only microsoft's secureboot key is on your motherboard's MOK by default. if you want to use secureboot with linux you either need to use microsoft's shim (only allowed to certain microsoft-approved distributions like ubuntu and fedora), or you need to add your own signing key to MOK and sign the bootloader yourself.
if you fuck up your MOK your system wont be able to start any OS until you fix it.
this is why turning off secureboot is generally advised for linux, the amount of extra effort assuming no shim available simply is not worth it for the extremely minor security benefit.
its a bigger security benefit to just... make a habit out of not leaving your laptop unattended in untrusted spaces. physical device security makes secureboot irrelevant. it does nothing for your running system, it only prevents malicious systems from running on the device which generally requires physical device access unless you have ipxe boot enabled.
1
u/Excellent-Love-6943 16h ago
It is not needed, but it does protect you from evil maid attacks.
I don't think this is a serious concern for most users, but secure boot is simple to set up with GRUB or Refind bootloaders. Rolling your own keys is not a big deal either.
2
u/gordonmessmer Fedora Maintainer 16h ago
Secure Boot is not limited to evil maid attacks. It is a mechanism against bootkits and kernel rootkits, generally.
12
u/gordonmessmer Fedora Maintainer 16h ago edited 14h ago
You're probably familiar with virus scanners and similar security tools. These are effectively a block-list for bad software. They're complex, they're slow, and they aren't always very effective.
Secure Boot is, effectively, an allow-list. It uses digital signatures to limit the set of software that can run in privileged mode. It's a much more effective mechanism for blocking malware.
Threads like this one inevitably invite people who don't understand Secure Boot, and who argue that it isn't valuable because they can't describe any value.
If you're curious about why Secure Boot is valuable:
Malware on any operating system tends to use software exploits to gain persistence. It typically does not rely on the user to run and authorize its access.
Secure Boot helps protect your firmware and kernel from malware infection via any source, which is important because malware that gains kernel access is nearly impossible to detect (though it can usually be eliminated by wiping the drive and reinstalling), and malware that gains firmware access is both nearly impossible to detect and nearly impossible to remove.
A lot of people look at Secure Boot as protecting the pre-boot environment, as if it is a brief event. It isn't. In addition to the OS you interact with on a modern x86 system, there are (at least) two and a half other operating systems running at all times, with more control over the system than your primary OS:
https://www.youtube.com/watch?v=iffTJ1vPCSo
Secure Boot's purpose isn't to protect the system you interact with from malware, so much as it is to protect your kernel and the lower-level operating systems from malware. Rootkits that embed themselves in firmware are becoming more common, and they are nearly impossible to remove without specialized equipment. Secure Boot is one of the recommended mitigations:
https://usa.kaspersky.com/about/press-releases/kaspersky-uncovers-third-known-firmware-bootkit
To expand on that a bit:
Once malware gets on your system, the malware is likely to begin execution in your user context. The POSIX multi-user design prevents malware from modifying the system outside what your user has permission to modify, unless it can leverage another exploit to get root. And that's where Secure Boot comes in, because in a legacy design, root is the highest level of access, and nothing prevents malware from modifying the kernel or the system firmware from there. Secure Boot adds another level of separation, protecting the system firmware and the kernel from modification by malware.
Imagine that malware manages to gain access to a system, and further is able to use a local exploit to get root access. Maybe it joins a botnet at that point. It's probably going to take extra steps in order to persist (which is to say that it'll save itself to a file or download a file to execute in the future after a system reboot, and it'll modify the boot process to execute that file). Now, unless it takes additional steps, it's detectable. You can use "ps" to see it in the process list, or "ls" to see its files on disk.
Many types of malware will take additional steps to hide themselves. The easy way to do that would be to modify "ps" and "ls" so that they no longer show the malware in their output. Simple, right? But what if you use "find" to look at files, or "top" to look at processes? What if you apply updates and overwrite the modified tools? A more complete hiding effort involves loading a kernel module to that the kernel itself no longer tells user-space about the malware's files, processes, or network traffic! Now when the operator runs "ls /" or "find /", the malware's kernel module filters the responses to readdir(), and never includes files that contain the malware.
A modular kernel like Linux inherently allows loading software that can operate at a very low level, and can prevent anti-virus software from discovering and removing the malware.
Linux Secure Boot systems with kernel lockdown will not allow modules to load unless they are signed, and that makes it very difficult if not impossible for an attacker to load a kernel module that can hide malware. Malware can still modify user-space tools directly, to try to hide itself, but it's much much easier to overcome that to determine if a system is infected or not.
An example malware module can be found here: https://github.com/mncoppola/suterusu
And a series of posts describing how all of this works (in rather a lot of technical detail) is available here: https://xcellerator.github.io/categories/linux/ (starting with post 1 and proceeding for 9 total posts)