Package: dracut
Version: 044+3-3
Severity: wishlist
Tags: patch

On 02-02-2016 22:27, Michael Biebl wrote:
> Regarding the flag files dracut generates for non-systemd mode:
> Could you please file a bug report so it uses
> /run/initramfs/fsck-root for /
> and
> /run/initramfs/fsck-usr for /usr
>
> I expect most users will use the systemd-enabled dracut initramfs, but
> it still seems worthwile fixing that.

Not sure if there is already an initsystem besides systemd that
honours these flag files, or if anyone uses dracut without using systemd
in the initramfs, but here we go. Patch attached (untested, but looks
obvious?).
From: Nis Martensen <nis.marten...@web.de>
Date: Fri, 5 Feb 2016 22:55:17 +0100
Subject: [PATCH] create fsck flag files in non-systemd mode

When / and /usr are successfully checked in the initramfs, indicate
this in flag files. The main init system can then skip the fsck for
these file systems.

This is not needed in systemd mode, since systemd will preserve its
knowledge about fsck status when switching to the main system.
---
 modules.d/95rootfs-block/mount-root.sh | 1 +
 modules.d/98usrmount/mount-usr.sh      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
index 924393b..3a21229 100755
--- a/modules.d/95rootfs-block/mount-root.sh
+++ b/modules.d/95rootfs-block/mount-root.sh
@@ -113,6 +113,7 @@ mount_root() {
         umount "$NEWROOT"
         fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
         _ret=$?
+        [ $_ret -eq 0 ] && : >/run/initramfs/fsck-root
         ran_fsck=1
     fi
 
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index 1699604..642682e 100755
--- a/modules.d/98usrmount/mount-usr.sh
+++ b/modules.d/98usrmount/mount-usr.sh
@@ -93,6 +93,7 @@ mount_usr()
                 fsck_usr "$_dev" "$_fs" "$_opts"
                 _fsck_ret=$?
                 [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run/initramfs/usr-fsck
+                [ $_fsck_ret -eq 0 ] && : >/run/initramfs/fsck-usr
             fi
         fi
 

Reply via email to