Am 27.12.2014 um 11:20 schrieb Michael Biebl: > Am 27. Dezember 2014 09:33:21 MEZ, schrieb Sven Joachim <svenj...@gmx.de>: >> I haven't looked at dracut, but with initramfs-tools 0.118 /usr is >> going >> to end up being mounted readonly. > > Hmm, good point. We'll need a more elaborate patch then which deals with both > cases
Attached is a more elaborate patch, which tests if /usr is mounted before trying to remount it in systemd-remount-fs. This should deal with both initramfs-tools 0.116 and 0.117 If anyone would be willing to review/test the patch, that would be very much appreciated. Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c index 847637a..a40f777 100644 --- a/src/remount-fs/remount-fs.c +++ b/src/remount-fs/remount-fs.c @@ -34,6 +34,26 @@ #include "mount-setup.h" #include "exit-status.h" +static bool is_mounted(const char *dev_path) { + _cleanup_endmntent_ FILE *mtab = NULL; + struct mntent *me = NULL; + + mtab = setmntent("/etc/mtab", "r"); + if (!mtab) { + log_error("Failed to open /etc/mtab: %m"); + return false; + } + + while ((me = getmntent(mtab))) { + if (me->mnt_fsname && + strcmp(me->mnt_fsname, dev_path) == 0) { + return true; + } + } + + return false; +} + /* Goes through /etc/fstab and remounts all API file systems, applying * options that are in /etc/fstab that systemd might not have * respected */ @@ -83,6 +103,11 @@ int main(int argc, char *argv[]) { !path_equal(me->mnt_dir, "/usr")) continue; + /* Don't remount /usr if it hasn't been mounted by the initrd */ + if (path_equal(me->mnt_dir, "/usr") && + !is_mounted("/usr")) + continue; + log_debug("Remounting %s", me->mnt_dir); pid = fork();
signature.asc
Description: OpenPGP digital signature