[Bug 874774] Re: could not mount /dev/mapper/cryptswap1

Steve Langasek steve.langasek at canonical.com
Fri Nov 11 21:35:15 UTC 2011


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/
slangasek at ubuntu.com                                     vorlon at debian.org

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

Title:
  could not mount /dev/mapper/cryptswap1

Status in “cryptsetup” package in Ubuntu:
  Triaged
Status in “cryptsetup” source package in Oneiric:
  Triaged
Status in “cryptsetup” source package in Precise:
  Triaged

Bug description:
  On multiple fresh installs since beta release 2 i have been experiencing this issue:
  during boot up, i receive the message "could not mount /dev/mapper/cryptswap1 M for manual S for skip"
  obviously I'm expecting no message to show up at all and it should boot perfectly fine. I do however believe that i have found where the problem lies, it is in /etc/fstab
  This is how the original file looked:

  # /etc/fstab: static file system information.
  #
  # Use 'blkid' to print the universally unique identifier for a
  # device; this may be used with UUID= as a more robust way to name devices
  # that works even if disks are added and removed. See fstab(5).
  #
  # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  proc            /proc           proc    nodev,noexec,nosuid 0       0
  # / was on /dev/sda7 during installation
  UUID=482c5b33-9ce8-4575-b787-cddeb1e93a5e /               ext4    errors=remount-ro 0       1
  # swap was on /dev/sda8 during installation
  #UUID=eb23dadc-8e08-4769-8fc5-0b1216b67e5b none            swap    sw              0       0
  /dev/mapper/cryptswap1 none swap sw 0 0

  
  i believe the problem is that the following line of:
  #UUID=eb23dadc-8e08-4769-8fc5-0b1216b67e5b none            swap    sw              0       0

  is not supposed to be commented out, i believe this happens somewhere
  in install. The ghetto fix for this is simply to remove the comment on
  it, but it definitely should not be happening...

  i have also found a eerily similar problem from Ubuntu 9.10 Bug
  #490760  which is a "duplicate" of another bug that is why i
  classified this as cryptsetup, because that bug was.

  Here is more information:

  Description:	Ubuntu 11.10
  Release:	11.10

  cryptsetup:
    Installed: 2:1.1.3-4ubuntu2
    Candidate: 2:1.1.3-4ubuntu2
    Version table:
   *** 2:1.1.3-4ubuntu2 0
          500 http://us.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
          100 /var/lib/dpkg/status

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




More information about the foundations-bugs mailing list