Please, how do I set systemd-boot/kernelstub (/boot/efi/loader/loader.conf
) to remember last booted OS? In GRUB its easy by GRUB_SAVEDEFAULT=true
... but in POP! OS... How? Thanks!
4 Answers
Such feature/option is not implemented in systemd-boot, at least not entirely. You can at best press d
to save the highlighted entry as conf-overriding default in an EFI variable. If you want "last as default" to happen you need to press d
every time before Enter
.
It shouldn't be too hard to implement, although I am not sure if upstream want to have such option, as they probably tend to keep systemd-boot simple.
Besides, you can always use grub instead.
-
I am aware I may use GRUB instead, but... why? I like the idea of having simple EFI boot loader... I believe adding this would not jeopardize the simplicity philosophy in any way, it is very convenient to have the laptop boot last-used OS. Thanks for the "d" trick, unfortunately, this does not solve the problem in case of planned restarts etc :( I've asked here, too chat.pop-os.org/community/channels/support– crysmanCommented Apr 3, 2021 at 22:04
-
You can always try to file a feature request (or even open a pull request with your own patch) on the systemd github repo.– Tom YanCommented Apr 3, 2021 at 22:08
That's the neat part: You don't.
We do not want to write to the EFI variables unless such action is explicitly requested by the user. The EFI variable store is fragile on some machines and it should not be touched by any action during normal operations.
There is the d key for for default, to set the default manually.
https://github.com/systemd/systemd/issues/477#issuecomment-118436201
Your best bet would be to install GRUB2.
This has been implemented by setting
default @saved
in the loader.conf
and running bootctl install
see https://man.archlinux.org/man/loader.conf.5#OPTIONS or man loader.conf
for details.
-
I've just tried it and no luck :( It just boots Windows unfortunately. I'm on systemd 249 (249.11-0ubuntu3.7pop1~1686173093~22.04~4514189)– crysmanCommented Jun 12, 2023 at 6:00
-
I'm on EndevourOS with systemd 253.5-1. I also have a package called
kernel-install-for-dracut
version 1.7-5, which has a description of "Enables systemd-boot automation using kernel-install with dracut". I wonder if that's the missing link. I did find this comment in the systemd repo that talks about doing it on PopOS: github.com/systemd/systemd/issues/477#issuecomment-1406788175 . perhaps that will help? Commented Jun 13, 2023 at 16:24
Answers already mentions default @saved
in the loader.conf
and systemd changelog does not mention this, but based on the merge date of https://github.com/systemd/systemd/pull/21070 I assume that this option is available after systems 251.
PopOs 22.04 has systemd 249. So maybe this option will be available after the next popos release.
sudo bootctl status
should return Features: Support @saved pseudo-entry