Foxboron / sbctl

:computer: :lock: :key: Secure Boot key manager
MIT License
1.51k stars 87 forks source link

`sbctl.NewBundle` does not consider `--efi-stub` command line argument #211

Open ubergeek77 opened 1 year ago

ubergeek77 commented 1 year ago

I am trying to use sbctl to create a bundle using my own EFI stub loader provided by the stubby project.

It's not exactly a standardized location, but I have my loader saved to:

/usr/lib/stubbyboot/linuxx64.efi.stub

Here is the stbctl command I tried to use:

sbctl bundle -s -i /boot/intel-ucode.img \
      -l /boot/splash.bmp \
      -k /boot/vmlinuz-linux \
      -f /boot/initramfs-linux.img \
      -e /usr/lib/stubbyboot/linuxx64.efi.stub \
      -c /etc/kernel/cmdline \
      /boot/stubby.efi

This results in the following error:

no EFISTUB file found. Please install systemd-boot or gummiboot! no EFI stub found

Interestingly, if I purposely give -e/--efi-stub a path to a file that doesn't exist, it will fail with this error first:

/obviously/broken/path does not exist!

So it does check the path of --efi-stub, but then it never gets used again.

From reading the code, here's what I think happens:

I do not have a Go environment set up, so unfortunately I don't think I'll make a PR for this. However, I can provide my two cents on a potential fix:

Since sbctl is overriding the result of NewBundle anyway, it might be a good idea to pass those variables into NewBundle, so that NewBundle can just return them alongside any defaults it needs to detect.

Foxboron commented 1 year ago

Ah, this is an oversight because people usually do not pass --efi-stub at all I assume. Thanks for looking into it :)

ghost commented 1 year ago

I got this error message to on Gentoo

args

sbctl bundle -s -i /lib/firmware/amd-ucode/microcode_amd_fam17h.bin \ -k /boot/vmlinuz-6.3.9-gentoo-dist \
 -f /boot/initramfs-6.3.9-gentoo-dist.img \
-e /usr/lib/systemd/boot/efi/linuxx64.efi.stub \
-c /etc/kernel/cmdline /efi/gentoo.efi
no EFISTUB file found. Please install systemd-boot or gummiboot! no EFI stub found

I have installed systemd-boot with gnuefi use flag and I also checked that this file exists in my system