[pkg-cryptsetup-devel] Bug#554506: unable to find root volume

Harald Braumann harry at unheit.net
Mon Jun 28 13:09:55 UTC 2010


Package: cryptsetup
Version: 2:1.1.2-1
Severity: normal

This bug also hits, if a source device name of the form /dev/<vg>/<lv> is used
in /etc/crypttab. The hook script fails to properly map this to 
/dev/mapper/<vg>-<lv>

The reason is, that dmsetup changed the way links are set up in /dev. Formerly,
files in /dev/<vg>/ (or /dev/disk/by-uuid) where links to device files in 
/dev/mapper/. Now they are links to /dev/dm-*. 

The solution is simple, and actually already there in the function 
`canonical_device'. I've just copied that part to `get_device_opts'. Patch 
appended.

harry
-------------- next part --------------
--- cryptroot.a	2010-06-28 14:50:50.000000000 +0200
+++ cryptroot.b	2010-06-28 14:57:54.000000000 +0200
@@ -191,6 +191,16 @@
 			return 1
 		fi
 
+	        if [ "x${link%/dev/dm-*}" = "x" ]; then
+        	        # try to detect corresponding symlink in /dev/mapper/
+                	for dmdev in /dev/mapper/*; do
+                        	if [ "$(readlink -e "$dmdev")" = "$link" ]; then
+                                	link="$dmdev"
+					break
+                        	fi
+                	done
+        	fi
+
 		if [ "$link" != "${link#/dev/mapper/}" ]; then
 			echo "cryptsetup: NOTE: using $link instead of $source for $target" >&2
 			source="$link"


More information about the pkg-cryptsetup-devel mailing list