From bd29f9de69a369654d3cad13529224df9157d785 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 6 Mar 2019 22:49:52 +0100 Subject: [PATCH] shared/bootspec: do not fail on errors when reading EFI vars It seems that my EFI storage is corrupted. The kernel reports the file as present, but returns an error when reading. Nevertheless, this shouldn't prevent me from reading the entry list. Fixes #11909. --- src/shared/bootspec.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index fea8eb830af..afcf6f7ac13 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -664,12 +664,18 @@ int boot_entries_load_config( if (is_efi_boot()) { r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderEntryOneShot", &config->entry_oneshot); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) - return log_error_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m"); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m"); + if (r == -ENOMEM) + return r; + } r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderEntryDefault", &config->entry_default); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) - return log_error_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m"); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m"); + if (r == -ENOMEM) + return r; + } } config->default_entry = boot_entries_select_default(config); -- 2.47.3