fstab-generator: use DefaultDependencies=no for /sysroot mounts

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
This commit is contained in:
Jonathan Lebon 2019-04-10 17:28:15 -04:00 committed by Lennart Poettering
parent 574ef404d8
commit 30fdb8962a
1 changed files with 6 additions and 0 deletions

View 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