bless-boot: skip gracefully on kexec

If KExecsCount > 0 then do not attempt to mark a UKI, as the stub (and also
any addon and the bootloader) will not have been exercised, so there's no
guaranteed a full reboot with the same image will actually work.

Fixes https://github.com/systemd/systemd/issues/43738
This commit is contained in:
Luca Boccassi
2026-09-22 21:25:20 +02:00
parent f0f521c147
commit 06c2dfa73c
3 changed files with 43 additions and 0 deletions
+7
View File
@@ -80,6 +80,13 @@ if grep -qw luo_nboot=1 /proc/cmdline; then
assert_eq "$(busctl -j get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager KExecCount | jq -r '.data')" "1"
# Check that bless-boot does not fail after a kexec
if [[ -d /sys/firmware/efi ]]; then
for verb in good bad indeterminate; do
/usr/lib/systemd/systemd-bless-boot --path=/nonexistent "$verb"
done
fi
# The previous boot's shutdown timestamps were preserved across the kexec via LUO and are now exposed
# as the PreviousShutdown* properties (the live Shutdown* ones describe this boot, which is not shutting
# down, so they are unset here).