]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(overlayfs): overlayfs should not use rootfsflags as mount options
authorJo Zzsi <jozzsicsataban@gmail.com>
Sat, 6 Sep 2025 23:14:34 +0000 (19:14 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Sat, 13 Sep 2025 19:19:19 +0000 (15:19 -0400)
Do not pass all rootfsflags to overlay mount, as it breaks
overlay mount, e.g. if subvol rootfsflags is used for mounting
btrfs subvol.

Here is an example with ext4 rootfs that would result in a failed
boot without this commit.

```
rootflags='nodelalloc' ro rd.live.overlay.overlayfs=1
```

modules.d/70overlayfs/mount-overlayfs.sh

index dc1e04e8d8e1ad6f35c9d57f6c5016150ac32ac8..f84a14e41ca7fc63956181a5ca9efbfd4bd08fa3 100755 (executable)
@@ -5,8 +5,6 @@ command -v getarg > /dev/null || . /lib/dracut-lib.sh
 getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
 getargbool 0 rd.live.overlay.readonly && readonly_overlay="--readonly" || readonly_overlay=""
 
-ROOTFLAGS="$(getarg rootflags)"
-
 if [ -n "$overlayfs" ]; then
     if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
         ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
@@ -15,6 +13,6 @@ if [ -n "$overlayfs" ]; then
     fi
 
     if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then
-        mount -t overlay LiveOS_rootfs -o "$ROOTFLAGS,$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork "$NEWROOT"
+        mount -t overlay LiveOS_rootfs -o "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork "$NEWROOT"
     fi
 fi