From: Nis Martensen Date: Tue, 19 Jan 2016 21:01:43 +0000 (+0100) Subject: Skip filesystem check if already done by the initramfs X-Git-Tag: archive/raspbian/243-8+rpi1^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ee395b9fd32e64f130416b72fa822f4fdef0f11a;p=systemd.git 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 . Closes: #782522 Closes: #810748 Gbp-Pq: Topic debian Gbp-Pq: Name Skip-filesystem-check-if-already-done-by-the-initram.patch --- diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 76270aec..b9969d2d 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -308,6 +308,7 @@ static int add_mount( *where_escaped = NULL; _cleanup_fclose_ FILE *f = NULL; int r; + struct stat sb; assert(what); assert(where); @@ -391,9 +392,13 @@ static int add_mount( } if (passno != 0) { - r = generator_write_fsck_deps(f, 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, dest, what, where, fstype); + if (r < 0) + return r; + } } fprintf(f, "\n[Mount]\n"); diff --git a/units/systemd-fsck-root.service.in b/units/systemd-fsck-root.service.in index bea6c168..49df0316 100644 --- a/units/systemd-fsck-root.service.in +++ b/units/systemd-fsck-root.service.in @@ -16,6 +16,7 @@ Before=local-fs.target shutdown.target Wants=systemd-fsckd.socket After=systemd-fsckd.socket ConditionPathIsReadWrite=!/ +ConditionPathExists=!/run/initramfs/fsck-root [Service] Type=oneshot