]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dmsquash-live-root: Avoid mount source conflict on $BASE_LOOPDEV. 217/head
authorFrederick Grose <fgrose@sugarlabs.org>
Sun, 9 Apr 2017 01:01:19 +0000 (21:01 -0400)
committerFrederick Grose <fgrose@sugarlabs.org>
Sun, 9 Apr 2017 15:23:12 +0000 (11:23 -0400)
The newer mount utilities are more strict about directly shared
devices. For OverlayFS boots, which mount $BASE_LOOPDEV directly,
avoid a mount error by indirectly sharing the read-only base
filesystem through a second, over-attached $BASE_LOOPDEV for
the DM live-base target.

modules.d/90dmsquash-live/dmsquash-live-root.sh

index 264983f59417087598fa0ac14e88b0346e8787b1..3a25465c619486585eb1eb99be8eeb6dde04de69 100755 (executable)
@@ -241,7 +241,12 @@ do_live_overlay() {
     fi
 
     # Create a device that always points to a ro base image
-    echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
+    if [ -n "$overlayfs" ]; then
+        BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
+        echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
+    else
+        echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
+    fi
 }
 
 # we might have a genMinInstDelta delta file for anaconda to take advantage of