2aacef
From 2edd56af85a0360df8bc49a6ee19e0f1051a2d68 Mon Sep 17 00:00:00 2001
2aacef
From: Yu Watanabe <watanabe.yu+github@gmail.com>
2aacef
Date: Fri, 11 Nov 2022 09:34:17 +0900
2aacef
Subject: [PATCH] find-esp: downgrade and ignore error on retrieving
2aacef
 PART_ENTRY_SCHEME when searching
2aacef
2aacef
Fixes #25332.
2aacef
2aacef
(cherry picked from commit 01f234c6f5672926d6cfe4fbfcdb48326ce06250)
2aacef
2aacef
Related: #2138081
2aacef
---
2aacef
 src/shared/find-esp.c | 14 ++++++++++----
2aacef
 1 file changed, 10 insertions(+), 4 deletions(-)
2aacef
2aacef
diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c
2aacef
index dfe0574aba..aa0b02cc2f 100644
2aacef
--- a/src/shared/find-esp.c
2aacef
+++ b/src/shared/find-esp.c
2aacef
@@ -177,7 +177,9 @@ static int verify_esp_udev(
2aacef
 
2aacef
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &v);
2aacef
         if (r < 0)
2aacef
-                return log_error_errno(r, "Failed to get device property: %m");
2aacef
+                return log_full_errno(searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
2aacef
+                                      searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
2aacef
+                                      "Failed to get device property: %m");
2aacef
         if (!streq(v, "gpt"))
2aacef
                 return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
2aacef
                                       SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
2aacef
@@ -572,10 +574,11 @@ static int verify_xbootldr_blkid(
2aacef
         else if (r != 0)
2aacef
                 return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "%s: Failed to probe file system: %m", node);
2aacef
 
2aacef
-        errno = 0;
2aacef
         r = blkid_probe_lookup_value(b, "PART_ENTRY_SCHEME", &type, NULL);
2aacef
         if (r != 0)
2aacef
-                return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "%s: Failed to probe PART_ENTRY_SCHEME: %m", node);
2aacef
+                return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
2aacef
+                                      searching ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : SYNTHETIC_ERRNO(EIO),
2aacef
+                                      "%s: Failed to probe PART_ENTRY_SCHEME: %m", node);
2aacef
         if (streq(type, "gpt")) {
2aacef
 
2aacef
                 errno = 0;
2aacef
@@ -638,7 +641,10 @@ static int verify_xbootldr_udev(
2aacef
 
2aacef
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &type);
2aacef
         if (r < 0)
2aacef
-                return log_device_error_errno(d, r, "Failed to query ID_PART_ENTRY_SCHEME: %m");
2aacef
+                return log_device_full_errno(d,
2aacef
+                                             searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
2aacef
+                                             searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
2aacef
+                                             "Failed to query ID_PART_ENTRY_SCHEME: %m");
2aacef
 
2aacef
         if (streq(type, "gpt")) {
2aacef