From 301b4193a0f595008699b8f191bd23dfa3cb4b4b Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 29 Apr 2026 20:32:19 -0700 Subject: [PATCH] bootctl: remove fallback EFI Boot#### variable on uninstall This cleans up the fallback Boot#### entry that was registered on install. The logic cleaning up variables was moved from verb_remove into a new remove_variables function, which mirrors the install side. --- src/bootctl/bootctl-install.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/bootctl/bootctl-install.c b/src/bootctl/bootctl-install.c index b3f8be936b3..b609d8f227c 100644 --- a/src/bootctl/bootctl-install.c +++ b/src/bootctl/bootctl-install.c @@ -1964,6 +1964,18 @@ static int remove_loader_variables(void) { return r; } +static int remove_variables(sd_id128_t uuid) { + int r = 0; + + const char *path = strjoina("/EFI/systemd/systemd-boot", get_efi_arch(), ".efi"); + RET_GATHER(r, remove_boot_option(uuid, path, /* in_order= */ true)); + + const char *fallback_path = strjoina("/EFI/systemd/systemd-boot-fallback", get_efi_arch(), ".efi"); + RET_GATHER(r, remove_boot_option(uuid, fallback_path, /* in_order= */ true)); + + return RET_GATHER(r, remove_loader_variables()); +} + int verb_remove(int argc, char *argv[], uintptr_t _data, void *userdata) { int r; @@ -2031,9 +2043,7 @@ int verb_remove(int argc, char *argv[], uintptr_t _data, void *userdata) { return r; } - char *path = strjoina("/EFI/systemd/systemd-boot", get_efi_arch(), ".efi"); - RET_GATHER(r, remove_boot_option(c.esp_uuid, path, /* in_order= */ true)); - return RET_GATHER(r, remove_loader_variables()); + return remove_variables(c.esp_uuid); } int verb_is_installed(int argc, char *argv[], uintptr_t _data, void *userdata) { -- 2.47.3