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.
This commit is contained in:
Clayton Craft
2026-05-21 11:30:46 -07:00
parent 6e0ebe437b
commit 301b4193a0
+13 -3
View File
@@ -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) {