Skip to content

Secure Boot with CachyOS

How to dual boot CachyOS and Windows with Secure Boot ON ?

We are going to use rEFInd boot manager for this.

  1. Temporarily turn off Secure Boot and boot using the cachyos bootable usb.
  2. You’ll need an active internet connection now. Click Launch Installer > Online > Refind
  3. Continue with the installation then in partition select Manual Partition and create a partition of following: • Size: 500mb • Filesystem: fat32 • Mount point: /boot/efi • Flags: boot
  4. Create rest of the partitions (root, swap etc.) and continue with the installation and restart when completed.
  5. Install shim-signed and sbsigntools packages from the aur.
  6. Now run this command to re-install Refind with the installed shim and generate keys to sign the Refind binaries automatically.
Terminal window
sudo refind-install --shim /usr/share/shim-signed/shimx64.efi --localkeys
  1. Enter Y for the incoming prompts and complete the installation.
  2. Now sign the kernel binary with the keys generated by Refind using the following command.
Terminal window
sudo sbsign --key /etc/refind.d/keys/refind_local.key --cert /etc/refind.d/keys/refind_local.crt --output /boot/vmlinuz-linux-cachyos /boot/vmlinuz-linux-cachyos

The name of your kernel may vary!

  1. We are almost done! Now restart your device and turn on Secure Boot then boot normally.
  2. You will see a message saying Verification failed: Security Violation. Press Enter.
  3. It will open the Shim UEFI Key Management. Press any key to open the MokManager.
  4. In the Perform MOK management screen, select Enroll key from disk and browse to /EFI/refind/keys. Select refind_local.cer.
  5. Press Enter > Continue > Yes.
  6. Reboot your device.

Everything should work perfectly now. Run bootctl to check Secure Boot status.

Tips and Tricks

Signing with Hook

The kernel signing can be automated with a mkinitcpio post hook, see Secure Boot#Signing the kernel with a mkinitcpio post hook.

Using KeyTool

The KeyTool can be used to add/remove/replace keys from NVRAM of your device. To use it

  • Copy KeyTool.efi
Terminal window
sudo cp /usr/share/efitools/KeyTool.efi /boot/efi/EFI/refind/
  • Sign KeyTool.efi
Terminal window
sudo sbsign --key /etc/refind.d/keys/refind_local.key --cert /etc/refind.d/keys/refind_local.crt --output /boot/efi/EFI/refind/KeyTool.efi /boot/efi/EFI/refind/KeyTool.efi
  • Select KeyTool from the Refind boot screen to open it.

Credits

Thanks to Aritra Karak for writing this guide!