mirror of
https://github.com/systemd/systemd.git
synced 2025-03-25 18:50:18 +03:00
generator: downgrade Requires= → Wants= of fsck from /usr mount unit
Fixes #5099
This commit is contained in:
parent
cbdc9cfe2b
commit
afacf3fc8a
@ -164,7 +164,7 @@ int generator_write_fsck_deps(
|
||||
|
||||
} else {
|
||||
_cleanup_free_ char *_fsck = NULL;
|
||||
const char *fsck;
|
||||
const char *fsck, *dep;
|
||||
|
||||
if (in_initrd() && path_equal(where, "/sysroot")) {
|
||||
r = write_fsck_sysroot_service(dir, what);
|
||||
@ -172,7 +172,15 @@ int generator_write_fsck_deps(
|
||||
return r;
|
||||
|
||||
fsck = SPECIAL_FSCK_ROOT_SERVICE;
|
||||
dep = "Requires";
|
||||
} else {
|
||||
/* When this is /usr, then let's add a Wants= dependency, otherwise a Requires=
|
||||
* dependency. Why? We can't possibly unmount /usr during shutdown, but if we have a
|
||||
* Requires= from /usr onto a fsck@.service unit and that unit is shut down, then
|
||||
* we'd have to unmount /usr too. */
|
||||
|
||||
dep = !in_initrd() && path_equal(where, "/usr") ? "Wants" : "Requires";
|
||||
|
||||
r = unit_name_from_path_instance("systemd-fsck", what, ".service", &_fsck);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create fsck service name: %m");
|
||||
@ -181,9 +189,9 @@ int generator_write_fsck_deps(
|
||||
}
|
||||
|
||||
fprintf(f,
|
||||
"Requires=%1$s\n"
|
||||
"After=%1$s\n",
|
||||
fsck);
|
||||
"%1$s=%2$s\n"
|
||||
"After=%2$s\n",
|
||||
dep, fsck);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user