From: Zbigniew Jędrzejewski-Szmek Date: Tue, 11 Jan 2022 09:56:50 +0000 (+0100) Subject: bootctl: do not update sd-boot if it wasn't installed in the first place X-Git-Tag: v251-rc1~553^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F22082%2Fhead;p=thirdparty%2Fsystemd.git bootctl: do not update sd-boot if it wasn't installed in the first place Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2038289. --- diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index e21a183baf1..1bcb4d16899 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1791,6 +1791,17 @@ static int verb_install(int argc, char *argv[], void *userdata) { if (r < 0) return r; + if (!install) { + /* If we are updating, don't do anything if sd-boot wasn't actually installed. */ + r = are_we_installed(); + if (r < 0) + return r; + if (r == 0) { + log_debug("Skipping update because sd-boot is not installed in the ESP."); + return 0; + } + } + r = acquire_xbootldr(/* unprivileged_mode= */ false, NULL); if (r < 0) return r;