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
--- 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"

Reply via email to