bootctl: handle if LoaderSystemToken is invalid for some reason

This points to some firmware issue, but we should still be able to
correct things if this happens. Hence log about this and fix it.

Fixes: #17041
This commit is contained in:
Lennart Poettering 2020-09-14 12:35:19 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 0c94a31464
commit ad0b610b0c
1 changed files with 3 additions and 1 deletions

View File

@ -1454,7 +1454,9 @@ static int install_random_seed(const char *esp) {
}
r = efi_get_variable(EFI_VENDOR_LOADER, "LoaderSystemToken", NULL, NULL, &token_size);
if (r < 0) {
if (r == -ENODATA)
log_debug_errno(r, "LoaderSystemToken EFI variable is invalid (too short?), replacing.");
else if (r < 0) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to test system token validity: %m");
} else {