Systemd-boot automatic update with systemd-boot-manager

I forgot that bootctl command - thank’s for reminding me :wink:

1 Like

@dalto it doesn’t seem to bee working for me, no matter where I mount /efi. esp can’t be /boot because it’s too small, so I’m using XBOOTLDR

[root@manjaro-gnome /]# bootctl --esp-path=/boot/efi --boot-path=/boot install
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
Random seed file /boot/efi/loader/random-seed successfully written (512 bytes).
Created EFI boot entry "Linux Boot Manager".
[root@manjaro-gnome /]# bootctl -p                                             
/boot/efi
[root@manjaro-gnome /]# rm -rf /boot/loader                                    
[root@manjaro-gnome /]# sdboot-manage gen                                      
[root@manjaro-gnome /]# ls /boot/efi/loader/entries                            
[root@manjaro-gnome /]# sdboot-manage update                                   
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
[root@manjaro-gnome /]# ls ls boot/efi/loader/entries                          
ls: cannot access 'ls': No such file or directory
boot/efi/loader/entries:
[root@manjaro-gnome /]# ls  boot/efi/loader/entries
[root@manjaro-gnome /]# ls /boot                                               
efi				    intel-ucode.img
initramfs-5.10-x86_64-fallback.img  linux510-x86_64.kver
initramfs-5.10-x86_64.img	    vmlinuz-5.10-x86_64

The problem is that xbootldr didn’t exist when I initially wrote systemd-boot-manager and support for that has never been added.

I created and edited new config file Manjaro.conf in /boot/efi/loader/entries.
Then I copied all imgs and vmlinuz from /boot into /boot/efi/EFI/ManjaroBoot. It worked fine.
But my change is gone after pacman update.
I do not know how to change pacman’s hook.

If you want to manage your own entries, you can simply uninstall systemd-boot-manager or disable it.

However, I would warn you that your approach is going to have some challenges going forward.

When your kernels update, the files in /boot/efi/EFI/ManjaroBoot won’t get updated. The same thing as new kernels are installed.

If you explain what you are trying to accomplish by doing that, maybe we can offer an alternative.

You can add what you want to change in the file /etc/sdboot-manage.conf so that every time the boot loader update, it will add the options accordingly.

1 Like

systemd-boot-manager with this config /etc/sdboot-manage.conf does not work for me, because I am using /boot/efi not /boot or /efi.

Has anybody found a solution to the above problem.
I have esp path at /efi and boot path too at /efi:

➜  ~ bootctl --print-esp-path    
/efi
➜  ~ bootctl --print-boot-path
/efi

Kernel images are kept at /boot and if i change boot path to /boot it gives me an error:

➜  ~ sudo bootctl --esp-path=/efi --boot-path=/boot install 
Block device node of "/boot" is invalid.

it should be sudo bootctl --esp-path=/efi install

initramfs-5.13-x86_64.img and all other .img files are kept in /boot so I have to externally supply the source of img files by --boot-path=/boot.

I think bootctl can not access /boot as ext4 in the same partition of / or I am wrong.
But you can copy img files into /boot/efi/. But the files are not updated in /boot/efi or there is no automation of update. Or you create new bash-script and write own command to update them.

That is why I switch back to GRUB.

When you use systemd-boot - your EFI parition must be mounted at /boot or /efi but not both and not /boot/efi

It is mounted at /efi and /boot has all .img files.

I think you have misunderstood how systemd-boot works.

For systemd-boot to be functional you need your kernel img on the efi partition.

First unmount your /boot/efi - mount your $esp temporarily on /mnt and copy only the kernel files to the temporary mount.

Then rename your /boot to /boot.bak and create a new folder /boot

unmount the temporary mount at /mnt and mount it at /boot

modify your /etc/fstab to mount at /boot instead of /boot/efi

that should be it

2 Likes

Actually there’s another option. What @garvitjoshi9 tries to achieve is to mount $esp to /efi and mount boot to /boot but he missed that he needs a separate VFAT-formatted XBOOTLDR partition according to systemd-boot specs in order to have this working.

Thank You for the instructions but I am new to systemd-boot and mount as I have not used these things before. So Sorry, I cannot understand fully what you are trying to say. The problem i was having with grub was that it was not working with secure boot after signing the .efi files. So i had to move to systemd-boot and it was difficult to configure so i reinstalled grub with: sudo grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=Manjaro --modules="normal test efi_gop efi_uga search echo linux all_video gfxmenu gfxterm_background gfxterm_menu gfxterm loadenv configfile tpm" --disable-shim-lock and again signed the .efi file and everything works now with secure boot. I will have to learn more new things before starting with systemd-boot. The original issue is here.

I Hope systemd-boot becomes easy to configure in coming years. Unlit then I will have to work with GRUB.

Ha, it’s wasy once you read this:
https://systemd.io/BOOT_LOADER_SPECIFICATION/
:grinning_face_with_smiling_eyes:
Also, there’s no much sense of having Secure Boot with default Grub configuration using separate vmlinuz and initrds, no encryption and no TPM verification. Note, no much sense, not saying no at all.

1 Like

It works now, then uninstall GRUB. thanks!