Blob Blame History Raw
From acc782bad5c77a8e105c9c5a8fc8873bc2ff06ec Mon Sep 17 00:00:00 2001
From: Norbert Lange <norbert.lange@andritz.com>
Date: Mon, 6 Jul 2020 18:16:13 +0200
Subject: [PATCH] mount-root.sh: fix writing fstab file with missing fsck flag

if the kernel argument rootflags is set, then dracut will
not parse the rootfs fstab and rootfsck wil not be set.

if the filesystem can be fsck'ed then its unmounted,
and an entry to the local fstab is written, omitting the last
field.

mounting /sysroot using fstab will then fail.

This change makes sure that the filed is always written.

Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
---
 modules.d/95rootfs-block/mount-root.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
index 0eddbcd5..6503b517 100755
--- a/modules.d/95rootfs-block/mount-root.sh
+++ b/modules.d/95rootfs-block/mount-root.sh
@@ -116,7 +116,7 @@ mount_root() {
         ran_fsck=1
     fi
 
-    echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab
+    echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 ${rootfsck:-0}" >> /etc/fstab
 
     if ! ismounted "$NEWROOT"; then
         info "Mounting ${root#block:} with -o ${rflags}"