systemd-boot updater

i have just added support for systemd-boot-manager’s config file to pacui:


Sorry if that’s a bit off-topic. Just in case someone needs a very simplistic kernel version update solution for systemd-boot. Built this last autumn after not finding anything similar, but had no time to share this until now.


Operation = Install
Operation = Upgrade
Type = Package
Target = linux*
Description = Update Bootloader Entries
When = PostTransaction
Exec = /usr/local/sbin/



uuid=$(blkid -o value -s UUID /dev/nvme0n1p2)
root=$(findmnt -no SOURCE -r /)
major_versions=$(pacman -Qe | awk '$1 ~ /^linux[0-9]+/ {split($2,v,"."); print v[1] "." v[2];}')
arch=$(uname -m)

# generate entries
for major in $major_versions; do
    # main
    cat > /boot/loader/entries/manjaro-$version.conf <<EOF
title	Manjaro Linux $major
linux	/vmlinuz-$version
initrd	/intel-ucode.img
initrd	/initramfs-$version.img
options	cryptdevice=UUID=$uuid:cryptroot root=$root rw
    # fallback
    cat > /boot/loader/entries/manjaro-$version-fallback.conf <<EOF
title	Manjaro Linux $major
linux	/vmlinuz-$version
initrd	/intel-ucode.img
initrd	/initramfs-$version-fallback.img
options	cryptdevice=UUID=$uuid:cryptroot root=$root rw

# generate loader.conf
cat > /boot/loader/loader.conf << EOF
default  manjaro-$major-$arch
timeout  1

# clean up the obsolete entries
for f in /boot/loader/entries/manjaro-*.conf; do
    for m in $major_versions; do
        [[ $major == $m ]] && continue 2
    rm $f
1 Like

Thanks for sharing your script. I’ve never written any script but a few questions (if hopefully that makes sense :grinning: )

That’s for nvme disk. So the user will have to modify it to /dev/sdxy for non-nvme disk?
What happens if the user has several disks? Wouldn’t device mapping be inconsistent?
Is there any way to ensure the right mapping or to use uuid’s?

That’s for encrypted partition. And I guess a simpler
root=$root rw
would do for unencrypted partition? But again that’s using device mapping. Any way to use uuid’s?

Thanks and cheers.

ps: I also have a few (non-systemd-boot manjaro’s) that I can boot from systemd-boot as well as several non-manjaro OS’s that is either systemd-boot or non-systemd-boot that I can boot from systemd-boot. I have to manually change the entries.conf for them but I’ll won’t trouble you for now on this. Thought I’d mention it.


Forgot my key question. Sorry about that.
How about entries for 2 or more kernels?
Of course we can manually write in for these.
Can you automate these also?


The systemd-boot-manager includes similar functionality except it discovers the root disk information without having to hard code it.

That is what he is doing here:

major_versions=$(pacman -Qe | awk '$1 ~ /^linux[0-9]+/ {split($2,v,"."); print v[1] "." v[2];}')

He finds all the installed kernels and then later removes any entries not on this list.


Thanks for explaining to a non-coder. Cheers.

1 Like

Does this remove the quiet flag in the config file? Forgive my ignorance but when the kernel is updated I have to re-add quiet splash.

Kernel options are persistent in /boot/loader/entries/*.conf files.
I had no problems so far.

It generates using the options in /etc/sdboot-manage.conf

By default, that section looks like this:

# kernel options to be appended to the "options" line

You may be wanting something like this instead:

# kernel options to be appended to the "options" line

Perfect, thank you.

1 Like

Just tested this handy tool. It correctly detected most vital options including cryptdevice=blah-blah-blah:lvm, but without :allow-discards parameter. Got a couple of seconds gain compared to rEFInd haha.

1 Like

Can you show me what a working line looks like? If it is detectable, I should be able to add support.

Well, it is quite simple and looks like the following:
What I also noticed is rw option. For rEFInd I have to use ro, because with rw fsck systemd skips root partition. As far as I know, only grub allows using rw and it does not affect fsck checking of a root partition. Maybe I am wrong and systemd boot also allows this, could you please check? I have a screenshot in order to show what I mean:

The last log entry was generated when booting with ro (rEFInd), all the previous ones are rw/systemd.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.