]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: rework how we handle referenced but absent EFI boot entries
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Nov 2022 17:05:53 +0000 (18:05 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 18 Nov 2022 20:27:50 +0000 (05:27 +0900)
Follow-up for #25368.

Let's consider ENOENT an expected error, and just debug log about it
(though, let's suffix it with `, ignoring.`). All other errors will log
loudly, as they are unexpected errors.

src/boot/bootctl.c

index afda914d5292d0f4313bc08c5048d52acdb8a192..2565f54586e960fd1a0fa8fa8cfd4c72d5b9584c 100644 (file)
@@ -585,8 +585,12 @@ static int print_efi_option(uint16_t id, int *n_printed, bool in_order) {
         assert(n_printed);
 
         r = efi_get_boot_option(id, &title, &partition, &path, &active);
+        if (r == -ENOENT) {
+                log_debug_errno(r, "Boot option 0x%04X referenced but missing, ignoring: %m", id);
+                return 0;
+        }
         if (r < 0)
-                return log_debug_errno(r, "Failed to read boot option 0x%04X: %m", id);
+                return log_error_errno(r, "Failed to read boot option 0x%04X: %m", id);
 
         /* print only configured entries with partition information */
         if (!path || sd_id128_is_null(partition)) {