Bug#810748: systemd does not mount /usr in initramfs, breaking split /usr
Nis Martensen
nis.martensen at web.de
Tue Jan 19 21:52:57 GMT 2016
Control: found -1 228-4
Attached a version of the patch that should work for testing/unstable.
Again intended as a replacement for the existing patch.
Concerning the relationship to #782522, I think we are fine:
With initramfs-tools, fsck flag files for / and /usr will be created and
their presence will be honored, both with the old and the new patch, and
both in jessie and testing/unstable.
With dracut in testing/unstable, fsck flag files are not needed to avoid
double fsck of / or /usr, since systemd will automatically do the right
thing. For /usr, this already works in jessie (assuming 810748 were
fixed), and for / it works in unstable since 220-1:
https://github.com/systemd/systemd/commit/4dda4e637e4c17a14db6cd265f36f5e8a5050367
This leaves the case with double fsck for / with dracut in jessie.
However, there is no regression since the bug was never solved, and
there is an easy workaround: When the fs_passno field in /etc/fstab is
set to 0 for the root file system, it won't be checked from the main
system. Only the initramfs does not know that and will check anyway.
Back to this bug, 810748. I agree that it may not be serious for
systemd, also due to the existing workaround. But when you look at it
from a dracut perspective, it means that a supposedly supported use case
(/usr mounted from initramfs) does not work. And it is kind of difficult
to learn about the workaround when your system does not boot. ;-) So it
may still be worth fixing for jessie. What do you think?
-------------- next part --------------
From: Nis Martensen <nis.martensen at web.de>
Date: Tue, 19 Jan 2016 22:01:43 +0100
Subject: [PATCH] Skip filesystem check if already done by the initramfs
Newer versions of initramfs-tools already fsck and mount / and /usr in
the initramfs. Skip the filesystem check in this case.
Based on a previous patch by Michael Biebl <biebl at debian.org>.
Closes: #782522
---
src/fstab-generator/fstab-generator.c | 11 ++++++++---
units/systemd-fsck-root.service.in | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index f7c8d11..2770ee6 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -244,6 +244,7 @@ static int add_mount(
*filtered = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
+ struct stat sb;
assert(what);
assert(where);
@@ -310,9 +311,13 @@ static int add_mount(
}
if (passno != 0) {
- r = generator_write_fsck_deps(f, arg_dest, what, where, fstype);
- if (r < 0)
- return r;
+ if (streq(where, "/usr") && stat("/run/initramfs/fsck-usr", &sb) == 0)
+ ; /* skip /usr fsck if it has already been checked in the initramfs */
+ else {
+ r = generator_write_fsck_deps(f, arg_dest, what, where, fstype);
+ if (r < 0)
+ return r;
+ }
}
fprintf(f,
diff --git a/units/systemd-fsck-root.service.in b/units/systemd-fsck-root.service.in
index 3617abf..1caa7bd 100644
--- a/units/systemd-fsck-root.service.in
+++ b/units/systemd-fsck-root.service.in
@@ -11,6 +11,7 @@ Documentation=man:systemd-fsck-root.service(8)
DefaultDependencies=no
Before=local-fs.target shutdown.target
ConditionPathIsReadWrite=!/
+ConditionPathExists=!/run/initramfs/fsck-root
[Service]
Type=oneshot
More information about the Pkg-systemd-maintainers
mailing list