]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: use DefaultDependencies=no for /sysroot mounts
authorJonathan Lebon <jonathan@jlebon.com>
Wed, 10 Apr 2019 21:28:15 +0000 (17:28 -0400)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Apr 2019 15:04:24 +0000 (17:04 +0200)
Otherwise we can end up with an ordering cycle. Since d54bab90, all
local mounts now gain a default `Before=local-fs.target` dependency.
This doesn't make sense for `/sysroot` mounts in the initrd though,
since those happen later in the boot process.

Closes: #12231
src/fstab-generator/fstab-generator.c

index 612b1789e320e1df59faf6e10f07f8d1e0a7664f..d35f2f993e98827d6b061431552b24b7e8de1a7f 100644 (file)
@@ -353,6 +353,12 @@ static int add_mount(
                 "Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
                 source);
 
+        /* All mounts under /sysroot need to happen later, at initrd-fs.target time. IOW, it's not
+         * technically part of the basic initrd filesystem itself, and so shouldn't inherit the default
+         * Before=local-fs.target dependency. */
+        if (in_initrd() && path_startswith(where, "/sysroot"))
+                fprintf(f, "DefaultDependencies=no\n");
+
         if (STRPTR_IN_SET(fstype, "nfs", "nfs4") && !(flags & AUTOMOUNT) &&
             fstab_test_yes_no_option(opts, "bg\0" "fg\0")) {
                 /* The default retry timeout that mount.nfs uses for 'bg' mounts