Setting up secure boot while dual booting Windows 11 and Arch Linux
I currently have a dual boot set up with Windows 11 and Arch Linux that I use for work. The company policy now requires us to set up secure boot. I looked at the wiki and to be honest it seems quite complicated/chaotic, and I'm pretty sure it'd take me several tries before getting it right.
How feasible would it be to set this up? Or would it be better to just ditch the dual boot and run Arch on a different machine?
About this post
- Posted
- Archived
- Score
- 1 · 67% up
- Kind
- Text
- ID
- 13d7rec
10 comments
By far the easiest is to use sbctl to generate, install and use keys to sign your efi images. You can use mkinitcpio to build the unified kernels automatically and a pacman trigger to rerun the sbctl signing when the kernel is updated. Pretty straightforward (once you've done it once).
sbctl also has a really neat feature that allows you to enroll checksums from the TPM event log, allowing you to get working hardware without using the Microsoft vendor keys. The only drawback is you have to manually sign the Windows boot files whenever they get updated (usually happens for the major monthly update that requires a reboot).
(disclaimer: it's an experimental feature and if it doesn't work you basically soft-brick your system, so you have to be sure you can restore the Microsoft keys or disable secure boot in some way. On my system I can just pull the battery from the motherboard, but YMMV).
If you're using GRUB you can follow the instructions in this post, it's pretty straightforward and you can set up secure boot in minutes.
I ended up going with this post. Would recommend to anyone with a similar set up. Thanks!
Hey, thanks for the guide.
I am a newbie, trying Arch Linux on Dual Boot.
When removing Arch Linux from Dual Boot, is it required to remove those keys manually from Linux to get rid of it safely?
There is a lot already written on this but to do this with minimal complications you can set up shim with refind.
Install refind, sbsigntools, mokutil from repos and shim-signed from the AUR.
Run: refind-install --shim /path/to/shimx64.efi --localkeys.
This will make MOK keys and run mokutil import. It will ask for a password to import the key on next boot.
Sign kernel with the key in /etc/refind.d/keys. Setup a pacman hook to sign kernels. There is an example in the arch wiki.
On your next boot the key used to sign refind and your kernels will be enrolled into MOK manager.
You can also do this with grub, but requires you to install grub with all the modules you need for booting embedded into the core image. Follow the arch wiki with how to do this but you may have issues with chainloading.
Bring it to your IT dept and tell them to set up dual boot...
I wasn't able to get shim working personally so I made my own signing keys and self sign my unified kernel image. That said, let your IT dept deal with it.
Dual booting is mid at best.
Maybe use a hypervisor inside one of the oses and be done with it?
Not hating on you for needing a working solution, just that dual boot is a pita.
Virtualbox emulates uefi and tpm. So if you use that inside windows which already has secure boot then you don't need to manage multiple keys and bootloaders.
this is not always the case there are lots of limits when running something on VMs
In addition to /u/m2noid's excellent post, I offer a slightly different alternative. It still uses refind (because setting up GRUB with secure boot is a pain in the ass), but instead of using sbsigntools, mokutil, and shim-signed, I use
sbctlto create and sign with my own keys.Before you get started with the below instructions, go into your BIOS and under the Secure Boot options, select Clear Keys or whatever option that puts Secure Boot into Setup Mode instead of User Mode. You need this mode to register new keys to the BIOS.
After that, boot into Arch, create your keys and sign your boot chain:
The thing that I love about sbctl is that it automates the key signing for you in a very easy way. It even ships with a pacman hook by default that will make
sbctlautomatically resign all files that you told it to sign during the initial setup, making kernel upgrades stress free.NOTE: Just like with grub, you do need to create a pacman hook for refind if you want the bootloader executables to be upgraded whenever the package gets upgraded. Here's my hook for reference. You can place it in
/etc/pacman.d/hooks:This triggers
refind-installand says yes to all the interactive questions. Because refind-install will install new bootloader executables, they also need to be re-signed, in which case I just callsbctl sign-allwhich will re-sign all the files that you've registered to it.Hope this helps!