Control: tags 810748 + patch

Moving the flag file test to the place where the fsck_deps are added may
work. Untested patch (intended to replace the culprit one, jessie
version) attached.

Can you test whether this compiles and fixes #782522 ? And, if it does,
possibly provide a .deb for jessie so I can test with my setup? (I'll
try creating a deb myself, but it may take a few days.)

Not sure if we also need to address #782522 for dracut, i.e., how can we
generate the flag file when systemd generates the fsck service in the
initramfs?
From: Michael Biebl <bi...@debian.org>
Date: Fr, 15 Jan 2016 07:03:23 +0200
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.

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 cb3d9dc..1557fb2 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -188,6 +188,7 @@ static int add_mount(
                 *filtered = NULL;
         _cleanup_fclose_ FILE *f = NULL;
         int r;
+        struct stat sb;
 
         assert(what);
         assert(where);
@@ -241,9 +242,13 @@ static int add_mount(
                 fprintf(f, "Before=%s\n", post);
 
         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 4162983..0668107 100644
--- a/units/systemd-fsck-root.service.in
+++ b/units/systemd-fsck-root.service.in
@@ -13,6 +13,7 @@ After=systemd-readahead-collect.service systemd-readahead-replay.service
 Before=local-fs.target shutdown.target
 
 ConditionPathIsReadWrite=!/
+ConditionPathExists=!/run/initramfs/fsck-root
 
 [Service]
 Type=oneshot

Reply via email to