On Fri, Nov 11, 2011 at 04:27:16PM -0000, TJ wrote:
> The attached patch can be applied using:

> sudo patch -p2 /lib/cryptsetup/cryptdisks.functions 0001-LP874774-Use-
> DEVLINKS-to-match-crypttab-entries.patch

diff --git a/debian/cryptdisks.functions b/debian/cryptdisks.functions
index 494697f..f0cfedb 100644
--- a/debian/cryptdisks.functions
+++ b/debian/cryptdisks.functions
@@ -641,6 +641,13 @@ crypttab_start_one_disk () {
                        src="/dev/disk/by-uuid/${src#UUID=}"
                elif [ "xLABEL=$ID_FS_LABEL_ENC" = "x$src" ]; then
                        src="/dev/disk/by-label/${src#LABEL=}"
+               elif [ -n "$DEVLINKS" ]; then
+                       for link in $DEVLINKS; do
+                               if [ "x$link" != "x$src" ]; then
+                                       continue
+                               fi
+                               break
+                       done
                elif [ "x$1" != "x$src" ]; then
                        continue
                fi

This doesn't have the desired effect when src does not match any of the
devlinks.  Note that there is both an inner and an outer loop here, and the
break and continue will only act on the inner loop - so with this patch, for
any ID_FS_USAGE=crypto device at all that has devlinks,
crypttab_start_one_disk() will try to start every device in /etc/crypttab.

Good insight on the cause of the bug, though; I didn't even think of the
fact that the real device name not being /dev/mapper/$name would cause this
problem.  Would you be willing to fix up this patch for the above-mentioned
bug?  I'm happy to sponsor the fix into the archive.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[email protected]                                     [email protected]

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/874774

Title:
  could not mount /dev/mapper/cryptswap1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/874774/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to