From 49927ad81313b77eab09749520d20a8f4ba7cc96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 11 Jan 2022 10:56:50 +0100 Subject: [PATCH] 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. --- src/boot/bootctl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- 2.47.3