From 98d3d0555d423da602ab941e04ffe2076455e86e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20La=C3=9F?= Date: Thu, 31 Aug 2023 20:03:38 +0200 Subject: [PATCH] 9990-main.sh: activate LVM volumes if needed. An update to the Debian lvm2 package removed a script in the initrd that would activate any LVs that are required to access the root volume. Due to this change, grml failed to find its live media when it was stored on an LVM volume. Add an explicit activation of any LVs mentioned in the `live-media` or `boofrom` kernel arguments, so that the live media can be found again. Fixes https://github.com/grml/grml/issues/200 --- components/9990-main.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/components/9990-main.sh b/components/9990-main.sh index 7fb7ed3..063445b 100755 --- a/components/9990-main.sh +++ b/components/9990-main.sh @@ -80,6 +80,30 @@ Live () fi fi + # If the live media location is given via command line and access to it + # involves LVM volumes, the corresponding volumes need to be activated. + IFS=',' + for dev in $(echo "$LIVE_MEDIA") + do + case "$dev" in + /dev/mapper/*) + eval $(dmsetup splitname --nameprefixes --noheadings --rows "${dev#/dev/mapper/}") + if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ] + then + lvm lvchange -aay -y --sysinit --ignoreskippedcluster "$DM_VG_NAME/$DM_LV_NAME" + fi + ;; + /dev/*/*) + # Could be /dev/VG/LV; use lvs to check + if lvm lvs -- "$dev" >/dev/null 2>&1 + then + lvm lvchange -aay -y --sysinit --ignoreskippedcluster "$dev" + fi + ;; + esac + done + unset IFS + # Scan local devices for the image i=0 while [ "$i" -lt 60 ] -- 2.1.4