Repository navigation
Description
Component
bootctl
Is your feature request related to a problem? Please describe
Systemd-boot right now installs itself (bootctl install) like this in the
ESP (star marks boot entry):
\EFI\BOOT\BOOTX64.EFI <-- systemd-boot
\EFI\systemd\systemd-bootx64.efi *
To make systemd-boot usable on real hardware with secure boot enabled, it would have to be signed by the MS 3rd party CA. That's probably not going to happen so the way to do that would be make sd-boot bootable by shim.
Describe the solution you'd like
Assuming systemd-boot is signed with a vendor certificate, the
way to install both shim and systemd-boot would be what is outlined
in https://github.com/rhboot/shim/blob/main/README.fallback
for removable media:
\EFI\BOOT\BOOTX64.EFI <-- shim
\EFI\BOOT\MokManager.efi
\EFI\BOOT\grubx64.efi <-- systemd-boot
for an installed system:
\EFI\BOOT\BOOTX64.EFI <-- shim
\EFI\BOOT\MokManager.efi
\EFI\BOOT\fallback.efi
\EFI\vendor\BOOT.CSV
\EFI\vendor\shim.efi *
\EFI\vendor\MokManager.efi
\EFI\vendor\grubx64.efi <-- systemd-boot
(Yeah, for now systemd-boot would have to name itself after grub as
that's hardcoded in shim).
So my question is would you accept patches to bootctl that (eg via
build time option) installs systemd-boot as outlined above if shim
is installed?
If so, a way would be to eg have the shim package symlink it's files
into /usr/lib/systemd/boot/efi/. Bootctl already installs *.efi from
there. We'd need a hack to the systemd-boot -> grub renaming though.
The other alternative would be to either not use bootctl install
at all, or have some script mangle what it did to retrofit shim.
Thoughts? :-)
Describe alternatives you've considered
No response
The systemd version you checked that didn't have the feature you are asking for
No response
Activity
YHNdnzj commentedon Apr 12, 2023
IMO this should not be handled by
bootctl. The use of shim (and where it gets installed) is distinct across distros, and thus they shall provide their own tools to tackle with this.Yukigamine commentedon Apr 12, 2023
If you can point me to a tool in Arch that will automatically stick a copy of
systemd-boot64.efiintogrubx64.efi, I'm all ears.I ended up here looking for exactly the kind of solution that OP proposed. Because shim is hardcoded to look for
grubx64.efiand PreLoader is hardcoded to look forloader.efithere are limited options when it comes to automating updates.If
bootctlsupported specifying additional paths/names as an optional parameter, it would be a reasonably clean solution.YHNdnzj commentedon Apr 12, 2023
Well,
bootctl installbasically does two things: install the boot loader toesp/EFI/systemd/andesp/EFI/BOOT/, plus adding an EFI boot entry. Since you're using shim/preloader, you don't need sd-boot to be installed to the mentioned destinations nor the boot entry since it's chainloaded by shim. So a simplecpwill work for you IIUC?YHNdnzj commentedon Apr 12, 2023
I actually think this makes more sense than adding a build option. It has more use cases, for both end users and distro maintainers, while still retaining the default behavior of installing to the aforementioned places.
lnussel commentedon Apr 13, 2023
Command line options are not useful for the distro unless there's also support for a global config file to enable the settings by default. So just calling
bootctl installworks out of the box.With shim the EFI boot entry must not point to sd-boot but shim. So bootctl install would need to know what path to put.
Regarding distro differences that's why I had the idea to symlink shim files into
/usr/lib/systemd/boot/efi/so bootctl can just pick them up and do the right thing.Anyway another idea that came to my mind was to have a script eg
/usr/lib/systemd/boot/install(or even scripts in.d) that when present gets executed bybootctl installinstead of the builtin code. bootctl could pass some env vars with settings, like mount point of the efi partition. That script could be shipped by the shim package. So if no shim is installed, bootctl would just use it's built in code.systemd: Disables 'efi' and 'gnu-efi' support
alexojegu commentedon Oct 19, 2024
A configuration file would be great, something like
/etc/systemd/boot.conf:So that
bootctl updatehas the same behavior as now, but renamingsystemd-boot64.efitogrubx64.efi. Tobootctl installI see two options:grubx64.efi(It would be the same behavior as now).shimx64.efi(It could be simplified but it would be more risky).About the path, just keep using the same one as now
/ESP/EFI/systemd/(At least in Arch Linux, I don't know if it is a build option). For more exotic configurations the user or distribution will be responsible.Nowa-Ammerlaan commentedon Oct 20, 2024
You don't actually have to rename systemd-boot to grub, shim loads the efi file it is given as an argument before it loads the hardcoded
grubx64.efi. Like this:This I think is much cleaner.
alexojegu commentedon Oct 20, 2024
Thanks @Nowa-Ammerlaan, I tried it but don't work with my hardware (It is 8 years old).
https://wiki.gentoo.org/wiki/Shim#systemd-boot
Nowa-Ammerlaan commentedon Oct 20, 2024
Mine is also about that old, how did you create this entry? The correct way is:
The way
efibootmgr -uprints the result makes it look identical to:but that will not work.
This is almost always the case (and if it is not then that is a serious UEFI bug). Windows also relies on passing arguments to the Windows boot loader via UEFI entry.
alexojegu commentedon Oct 20, 2024
I tried to create it again before replying, this was the command:
alexojegu commentedon Oct 20, 2024
I created the entry again now, by mistake, and when I deleted it... see this:
Some times
\EFI\Systemd\systemd-bootx64.efiis converted to5c004500460049005c00530079007300740065006d0064005c00730079007300740065006d0064002d0062006f006f0074007800360034002e00650066006900Nowa-Ammerlaan commentedon Oct 20, 2024
That's the same, just presented differently. Note the difference between the output of
efibootmgrandefibootmgr -u.If it still does not work I recommend upgrading the UEFI (if there is an update available). Note also that sometimes this is case-sensitive (even though it shouldn't be due to the FAT file system).
alexojegu commentedon Oct 20, 2024
Yeah, the latest BIOS update for this Dell model is from 2021 and is installed.
On a couple of occasions after displaying
5c004500460049005c00530079007300740065006d0064005c00730079007300740065006d0064002d0062006f006f007400780036003400 2e00650066006900, like now, when I reboot the Dell logo has disappeared (although everything seems to continue working correctly) and I have to reset the BIOS to defaults to get it to display again.arvidjaar commentedon Oct 20, 2024
@alexojegu Show
or whatever your boot entry number is.
alexojegu commentedon Oct 20, 2024
This entry:
Has this
hexdump:And it tries to load
grubx64.efi. I am usingshim-15.8-3signed by Fedora (x86_64):https://koji.fedoraproject.org/koji/buildinfo?buildID=2423319
Nowa-Ammerlaan commentedon Oct 20, 2024
I vaguely remember reading at some point that some older Dell boards indeed have an issue where arguments are not actually passed on to the EFI executable. Perhaps that is what is going on here. You could try to directly load some kernel image and try to pass a kernel cmdline to it.
arvidjaar commentedon Oct 20, 2024
It's OK. I was surprised that
efibootmgrdid not showFile(...), but apparently it was removed fromefivarsbecause it violated UEFI specs. Resulting in even more confusion over where path ends and parameters start.alexojegu commentedon Oct 20, 2024
You are right @Nowa-Ammerlaan, after a quick search I can find several references to Dell boards that do not pass arguments to the EFI executable (mostly older ones, but there is also one on the Gentoo forums from 2024).
So finally I think I will have to use a pacman hook to copy
systemd-bootx64.efitogrubx64.efion upgrade, instead of just usingbootctl update.alexojegu commentedon Oct 21, 2024
More info from: https://wiki.archlinux.org/title/EFI_boot_stub#Unbootable_stub_on_some_Dell_systems
Linux EFI thread: https://lore.kernel.org/linux-efi/[email protected]/
Workaround on Linux 5.10: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a568ce29d3f48df95919f82a80e4b9be7ea0dc1
So I assume
shimwould require a similar workaround, which it does not have implemented, to pass arguments to the EFI executable in several generation Dell firmwares.demitriusbelai commentedon Nov 5, 2024
@alexojegu I don't remember why I put a null terminator in args. I guess BIOS was putting some dirty at the end of args. I am working with a Dell OptiPlex 3080. I guess it worth a try. Here the command I used:
For reference, fwupd also adds a null terminator:
I'm currently booting directly into the Linux kernel, but I'm looking to switch to systemd-boot with Shim. I've been researching how to make this migration.
alexojegu commentedon Nov 8, 2024
Thank you very much @demitriusbelai, it's working!!!
mreilaender commentedon Dec 8, 2024
Currently on a similar setup on Manjaro and I can confirm that:
doesn´t pass the systemd argument to shim but instead shim looks for grubx64.efi. I'm on a Lenovo ThinkPad T14 Gen 1.
Can u not simply add something like:
U would be able to name it whatever u want and would solve the problem of having to rename systemd with some script ...
schaarsc commentedon May 22, 2025
In case of issues you may try
'\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI '(worked for me)Greek64 commentedon Oct 19, 2025
Space did it for me.
I remember having to do a similar trick once for the kernel commandline inside a EFI, where the last argument was malformed due to some extra garbage being appended, so I inserted a second
quietto the end of the arguments that would be ignored.