--- src/efibootmgr/efibootmgr.c | 3 +++ 1 file changed, 3 insertions(+) --- a/src/efibootmgr/efibootmgr.c +++ b/src/efibootmgr/efibootmgr.c @@ -467,6 +467,9 @@ remove_from_boot_order(uint16_t num) } } + if (new_i == 0) + return efi_del_variable(EFI_GLOBAL_GUID, "BootOrder"); + /* Now new_data has what we need */ free(boot_order->data); boot_order->data = (uint8_t *)new_data;