]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: provide a more useful message when ENOMEDIUM is returned
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 Nov 2021 12:06:37 +0000 (13:06 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 Nov 2021 16:43:01 +0000 (17:43 +0100)
src/shared/dissect-image.c

index c3345b3fad5ebd964b3af3434aa98bd23a552004..ec9bc51d00981cb5ec3528b3ebf129405b066bb4 100644 (file)
@@ -3309,29 +3309,32 @@ int dissect_image_and_warn(
                 return log_error_errno(r, "Dissecting images is not supported, compiled without blkid support.");
 
         case -ENOPKG:
-                return log_error_errno(r, "Couldn't identify a suitable partition table or file system in '%s'.", name);
+                return log_error_errno(r, "%s: Couldn't identify a suitable partition table or file system.", name);
+
+        case -ENOMEDIUM:
+                return log_error_errno(r, "%s: The image does not pass validation.", name);
 
         case -EADDRNOTAVAIL:
-                return log_error_errno(r, "No root partition for specified root hash found in '%s'.", name);
+                return log_error_errno(r, "%s: No root partition for specified root hash found.", name);
 
         case -ENOTUNIQ:
-                return log_error_errno(r, "Multiple suitable root partitions found in image '%s'.", name);
+                return log_error_errno(r, "%s: Multiple suitable root partitions found in image.", name);
 
         case -ENXIO:
-                return log_error_errno(r, "No suitable root partition found in image '%s'.", name);
+                return log_error_errno(r, "%s: No suitable root partition found in image.", name);
 
         case -EPROTONOSUPPORT:
                 return log_error_errno(r, "Device '%s' is loopback block device with partition scanning turned off, please turn it on.", name);
 
+        case -ENOTBLK:
+                return log_error_errno(r, "%s: Image is not a block device.", name);
+
         case -EBADR:
                 return log_error_errno(r,
                                        "Combining partitioned images (such as '%s') with external Verity data (such as '%s') not supported. "
                                        "(Consider setting $SYSTEMD_DISSECT_VERITY_SIDECAR=0 to disable automatic discovery of external Verity data.)",
                                        name, strna(verity ? verity->data_path : NULL));
 
-        case -ENOTBLK:
-                return log_error_errno(r, "Specified image '%s' is not a block device.", name);
-
         default:
                 if (r < 0)
                         return log_error_errno(r, "Failed to dissect image '%s': %m", name);