systemd-boot: kernel update can leave loader.conf on the old image, so the next boot starts the pre-update snapshot
Summary
On a machine that boots systemd-boot, a kernel update can leave /boot/loader/loader.conf pointing at the previous boot image. Once the live system has moved to the new image, the bare id of the old .efi resolves to its first remaining profile, which is the pre-update snapshot. The next reboot then starts the snapshot instead of the real system, without any menu or warning.
Both problems below come from the same thing: during the transaction, 10-linux-modules-post.hook restores the running kernel's modules directory (/usr/lib/modules/<running kver>, including its pkgbase file). For the rest of the transaction, two module directories have pkgbase = linux-omarchy.
1. omarchy-boot-sync sync silently skips the loader default
preferred_kernel (with no preferred= in the state file) builds its list from root_kernels, which gives one line per (pkgbase, kver). So grep -x linux-omarchy prints linux-omarchy twice. The caller then does
live=$(current_image "$preferred") # $STORE/current/$'linux-omarchy\nlinux-omarchy' -> not a link -> ""
[[ -n $live ]] && set_loader_default "omarchy-$ns-$live.efi"
so set_loader_default never runs. omarchy-boot-sync status during that window shows it directly:
preferred kernel: linux-omarchy
linux-omarchy
In my case loader.conf kept default omarchy-<ns>-linux-omarchy-9223bf43d334.efi (last written when the switch to systemd-boot finished), while the live omarchy profile now lived in …-12555ce24b32.efi. …-9223bf43d334.efi only had snapshot profiles left, so the bare id booted Snapshot 405 (the pre-update snapshot): rootflags=subvol=@/.snapshots/405/snapshot.
From reading the code this looks like it would hit any kernel update on systemd-boot, not only a downgrade, because the running kernel's directory is restored every time. I have only observed it on the downgrade below.
2. omarchy-boot-rebuild imports the restored running kernel as well
installed_kernels lists every /usr/lib/modules/*/pkgbase, including the restored running-kernel directory, and each import replaces $STORE/current/linux-omarchy, so the last one wins. On the 2026-12-01 update linux-omarchy went down (7.3.7-2 -> 1:7.3.6-5). 7.3.7-2-omarchy sorts after 7.3.6-5-omarchy, so the pacman log shows:
omarchy-boot-sync: boot image for linux-omarchy 7.3.6-5-omarchy is linux-omarchy-12555ce24b32
omarchy-boot-sync: boot image for linux-omarchy 7.3.7-2-omarchy is linux-omarchy-c7c3e6f54551
and the live entry became the old 7.3.7 kernel. omarchy-boot-sync verify reported The boot image for linux-omarchy is 7.3.7-2-omarchy, but 7.3.6-5-omarchy is installed. linux-modules-cleanup removes that directory on the next boot, so the live entry would have booted a kernel without modules.
Steps to reproduce
- Omarchy on systemd-boot (
omarchy-boot-switchfinished, phaseactive), nopreferred=in/var/lib/omarchy/boot/state. omarchy updatewith alinux-omarchyupdate (here the epoch-bumped 7.3.7-2 -> 1:7.3.6-5).- Before rebooting:
omarchy-boot-sync statusprints the preferred kernel twice;grep ^default /boot/loader/loader.confstill names the old image;bootctl listshows that image's bare id resolving to a snapshot. - Reboot: the machine starts the pre-update snapshot.
Expected
After a kernel update, loader.conf points at the image holding the live omarchy profile for the kernel that is actually installed. A restored running-kernel directory shouldn't count as an installed kernel, or at least shouldn't be imported over the new one or produce a duplicate preferred kernel.
Workaround
Rebuild and import the installed kernel (mkinitcpio -k <kver> -g <tmp>, omarchy-boot-sync import linux-omarchy <kver> /usr/lib/modules/<kver>/vmlinuz <tmp>, omarchy-boot-sync sync), then fix the default line in /boot/loader/loader.conf by hand.
System
- omarchy-dev 4.6.0.r8713.ge785eec-1 (update from r8697.gc587bba), omarchy-boot-systemd 4.6.0rc2-1, systemd 262.2-1
- AMD Ryzen 7 7800X3D, NVIDIA RTX 4070 SUPER (nvidia-open), MSI PRO B650-VC WIFI (AMI 1.M3)
- LUKS + btrfs, switched from Limine with
omarchy-boot-switchthe same day; Secure Boot on with sbctl keys (not related to this bug)
Filed by Claude Opus 5.5 via Claude Code.