So, I’ve installed Manjaro quite while ago, and I let secure boot disabled during installation. Dang! Is there a way to keep (most of) my system and enable secure boot and LUKS after the fact?

  • Illecors@lemmy.cafe
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    1 year ago

    It depends on a single variable - does your motherboard support manipulating the secure boot keys? I’ve only done it on prebuilt dells and dell laptops, but some other manufacturers also allow it.

    The procedure is very simple, but has many steps. Don’t get discouraged! I remember ArchWiki having a very thorough guide that worked for me.

    The gist of it is you provide UEFI firmware the cert to trust and then use the keys to sign your kernel image. I’ve never had to deal with signing the modules (mostly nVidia related, I think), but the procedure would be the same.

        • Illecors@lemmy.cafe
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          My bad, private repo. Here’s the content:

          #!/bin/zsh
          
          # 2022.09.26
          
          # Generate
          dracut --quiet --zstd --kver 6.0.2-gentoo --filesystems btrfs --early-microcode --uefi --uefi-splash-image $HOME/Nextcloud/Pictures/gentoo.full.height.nvme.bmp --uefi-stub /usr/lib/systemd/boot/efi/linuxx64.efi.stub --no-machineid --stdlog 4 --force --kernel-cmdline "rd.luks=1 rd.lvm=0 rd.md=0 rd.dm=0 rd.fstab=1 root=UUID=f5f8d75d-8aa8-4cea-83f9-3489a92a23e0 rd.luks.key=/luks.key:UUID=8E55-4050 rd.luks.uuid=5f5ab8ff-f1ea-4c09-960a-73f9bf5b7698 rootflags=noatime,discard=async,subvol=@snapshots/root/2022-10-18_102847 rootfstype=btrfs quiet delayacct i915.enable_guc=3"
          
          # Sign
          sbsign --key secure-boot/db.key --cert secure-boot/db.crt --output /boot/EFI/Linux/linux-6.0.2-gentoo.signed.efi /boot/EFI/Linux/linux-6.0.2-gentoo.efi
          
          # Change boot order
          efibootmgr --create --disk /dev/sdb --loader EFI/Linux/linux-6.0.2-gentoo.signed.efi --label Gentoo-6.0.2-signed --part 3 --verbose
          
          
          • Illecors@lemmy.cafe
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            I have since replaced the hardcoded values with variables, but evidently haven’t pushed the changes to gitlab. Having said that - not having variables might make it easier to understand in this case.

    • snake_cased@lemmy.mlOP
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      I think, I can install keys in my AMI bios. So, basically, I’d create some keys, sign the kernel with it, reboot, install them keys in UEFI, enable secure boot, and, fingers crossed, I’d boot?

      • Illecors@lemmy.cafe
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        You might have to enable Audit mode or similar - again, depends on the manufacturer - to generate the keys. But yes, essentially that’s the gist of it.

  • If you don’t load proprietary kernel modules, you can usually just install a signed bootloader (GRUB etc.) and just turn it on. Almost all motherboards come with a preloaded key for open source projects. Honestly, the advice to turn off secure boot before Linux is incredibly outdated.

    If you use the factory third party keys, you won’t get much extra protection out of secure boot without going through a whole process. It’s possible to validate each step in the chain but it’s more work than most people will find it worth.

    If you do load proprietary modules (i.e. you use Nvidia or DisplayLink) you’ll need to set up your own keys. That’ll involve a bunch of terminal commands and adding hooks to the package installer, but it’ll work with almost every motherboard. There’s a guide on the Arch wiki on how to do all that, it involves a whole bunch of signatures and keys and booting into a special program that loads the keys into your motherboard.

    If you’re dual booting, pay special attention to the guides so that the Windows bootloader still works. You can’t sign the Windows bootloader yourself, it’ll refuse to boot.

  • breadsmasher@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    1 year ago

    iirc Secure Boot requires the kernel to be signed with some payment given to (I think) Microsoft to do it. I believe Canonical / Ubuntu are one of the few to do this.

    So no, Manjaro as far I am currently aware, doesn’t support secure boot (or secure boot doesn’t support Manjaro)

    See this comment https://sh.itjust.works/comment/1796724

    • JollyGreen_sasquatch@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 year ago

      You can, and for Linux generally have to, manage your own secure boot keys and signing your own kernal, united, modules, etc. Conacal and Red Hat have signing keys iirc, but distributions can and do get the shim boot loader signed so secure boot works. The arch wiki has a page on how to setup secure boot . Many distros installers do end up signed as well so you can go through the full install process with secure boot enabled.

        • phoenix591@lemmy.phoenix591.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 year ago

          eh, its true if you want it to be signed by microsoft, which some projects have forked out for, buut it was put into the spec for x86_64 systems that users can replace the keys. so you can make your own keys, and if you want to dual boot add microsoft’s keys to the ok to boot list.

          one of the signed projects is a shim that lets you approve whatever you want more or less; pretty much everything that talks about MOK refers back to this shim. many distributions use this shim