Harald Hoyer 460d2c
From acc782bad5c77a8e105c9c5a8fc8873bc2ff06ec Mon Sep 17 00:00:00 2001
Harald Hoyer 460d2c
From: Norbert Lange <norbert.lange@andritz.com>
Harald Hoyer 460d2c
Date: Mon, 6 Jul 2020 18:16:13 +0200
Harald Hoyer 460d2c
Subject: [PATCH] mount-root.sh: fix writing fstab file with missing fsck flag
Harald Hoyer 460d2c
Harald Hoyer 460d2c
if the kernel argument rootflags is set, then dracut will
Harald Hoyer 460d2c
not parse the rootfs fstab and rootfsck wil not be set.
Harald Hoyer 460d2c
Harald Hoyer 460d2c
if the filesystem can be fsck'ed then its unmounted,
Harald Hoyer 460d2c
and an entry to the local fstab is written, omitting the last
Harald Hoyer 460d2c
field.
Harald Hoyer 460d2c
Harald Hoyer 460d2c
mounting /sysroot using fstab will then fail.
Harald Hoyer 460d2c
Harald Hoyer 460d2c
This change makes sure that the filed is always written.
Harald Hoyer 460d2c
Harald Hoyer 460d2c
Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
Harald Hoyer 460d2c
---
Harald Hoyer 460d2c
 modules.d/95rootfs-block/mount-root.sh | 2 +-
Harald Hoyer 460d2c
 1 file changed, 1 insertion(+), 1 deletion(-)
Harald Hoyer 460d2c
Harald Hoyer 460d2c
diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
Harald Hoyer 460d2c
index 0eddbcd5..6503b517 100755
Harald Hoyer 460d2c
--- a/modules.d/95rootfs-block/mount-root.sh
Harald Hoyer 460d2c
+++ b/modules.d/95rootfs-block/mount-root.sh
Harald Hoyer 460d2c
@@ -116,7 +116,7 @@ mount_root() {
Harald Hoyer 460d2c
         ran_fsck=1
Harald Hoyer 460d2c
     fi
Harald Hoyer 460d2c
 
Harald Hoyer 460d2c
-    echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab
Harald Hoyer 460d2c
+    echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 ${rootfsck:-0}" >> /etc/fstab
Harald Hoyer 460d2c
 
Harald Hoyer 460d2c
     if ! ismounted "$NEWROOT"; then
Harald Hoyer 460d2c
         info "Mounting ${root#block:} with -o ${rflags}"
Harald Hoyer 460d2c