diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-05 13:15:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-04-05 13:15:43 +0200 |
commit | 429d4e414d70ecb03366fee2e2d7c0ca42d060ac (patch) | |
tree | 5c69996ea91e984789114f29112034f91889496e | |
parent | 0bb8dfaa537ba52071642484cd10b02e1516ea8c (diff) | |
download | systemd-429d4e414d70ecb03366fee2e2d7c0ca42d060ac.tar.gz |
dissect: when pulling metadata from an image, don't bother with /home or ESP
When we try to read meta-data from an image, don't bother with mounting
/home or the ESP, as that's not where the metadata is. This not only
speeds things up a bit, but also has the benefit that setups where an
unencrypted root is mixed with an encrypted /home (which I have on one
of my own systems) won't result in errors that the crypto key is needed.
-rw-r--r-- | src/shared/dissect-image.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index c29d70fa04..f5de54d9fe 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -1291,9 +1291,11 @@ int dissected_image_acquire_metadata(DissectedImage *m) { if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0) _exit(EXIT_FAILURE); - r = dissected_image_mount(m, t, UID_INVALID, DISSECT_IMAGE_READ_ONLY); - if (r < 0) + r = dissected_image_mount(m, t, UID_INVALID, DISSECT_IMAGE_READ_ONLY|DISSECT_IMAGE_MOUNT_ROOT_ONLY); + if (r < 0) { + log_debug_errno(r, "Failed to mount dissected image: %m"); _exit(EXIT_FAILURE); + } for (k = 0; k < _META_MAX; k++) { _cleanup_close_ int fd = -1; |