dissect: when we invoke dissection on a loop device with partscan help the user

This adds some simply detection logic for cases where dissection is
invoked on an externally created loop device, and partitions have been
detected on it, but partition scanning so far was off. If this is
detected we now print a brief message indicating what the issue is,
instead of failing with a useless EINVAL message the kernel passed to
us.
This commit is contained in:
Lennart Poettering
2017-10-26 17:54:56 +02:00
parent eb38edce88
commit 759aaedc5c
3 changed files with 30 additions and 9 deletions
+4
View File
@@ -3883,6 +3883,10 @@ int main(int argc, char *argv[]) {
log_error_errno(r, "--image= is not supported, compiled without blkid support.");
goto finish;
}
if (r == -EPROTONOSUPPORT) {
log_error_errno(r, "Device is loopback block device with partition scanning turned off, please turn it on.");
goto finish;
}
if (r < 0) {
log_error_errno(r, "Failed to dissect image: %m");
goto finish;