installer uses /dev/dm-* in /etc/crypttab

Bug #1175406 reported by GeorgeAllen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ecryptfs-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

The /dev/dm-* names can get re-numbered when adding/removing changing LVM logical volumes and adding/removing USB drives containing LVM volumes. I performed a fresh install on a new hard drive, connected my old drive via USB, then ran into errors late in a 100G rsync copy. I traced the problem down to: my /dev/dm-* drives had been renumbered, and when cryptswap touched what it thought was the swap volume, it destroyed at data volume instead.

Cryptswap should reference volumes by /dev/disk/by-*/ or /dev/volumegroup/* rather than /dev/dm-*

Steps to recreate: (using Kubuntu 13.04 in a vm)
 - Disk Setup
 - Switch to console.
   sudo -i
   parted
    mktable gpt
    mkpart primary ext4 2048s 200M
    mkpart primary 200M -1s
    toggle 2 lvm
   reboot
   sudo -i
   pvcreate /dev/sda2
   vgcreate vg /dev/sda2
   lvcreate -L 5G -n root vg
   lvcreate -L 2G -n home vg
   lvcreate -L 1G -n swap vg
 - switch to installer
 - Custom Disk setup
   - assign disks as listed:
     vg-home /home
     vg-root /
     vg-swap swap
 - start installer

 - switch to console
    sudo -i
    cat /target/etc/crypttab
    cryptswap1 /dev/dm-2 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

from /var/log/installer/syslog
Apr 30 01:30:35 kubuntu ubiquity: INFO: Setting up swap: [/dev/dm-3]
Apr 30 01:30:35 kubuntu ubiquity: INFO: Successfully setup encrypted swap!

Tags: patch
Revision history for this message
GeorgeAllen (glallen01) wrote :
Revision history for this message
GeorgeAllen (glallen01) wrote :

Maybe this will help stabilize the device names in /etc/crypttab

--- /tmp/ecryptfs-setup-swap 2013-05-01 21:06:55.750474891 -0400
+++ /usr/bin/ecryptfs-setup-swap 2013-05-01 21:58:43.249884148 -0400
@@ -161,7 +161,7 @@
                [ -e "/dev/mapper/cryptswap$i" ] || break
        done
        # Add crypttab entry
- echo "cryptswap$i $swap /dev/urandom swap,cipher=aes-cbc-essiv:sha256" >> /etc/crypttab
+ echo "cryptswap$i $(findfs UUID=$uuid) /dev/urandom swap,cipher=aes-cbc-essiv:sha256" >> /etc/crypttab

        # Add fstab entry
        echo "/dev/mapper/cryptswap$i none swap sw 0 0" >> /etc/fstab

affects: ubiquity (Ubuntu) → ecryptfs-utils (Ubuntu)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fix-dm-reference.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
GeorgeAllen (glallen01)
summary: - installer uses /dev/dm-* in /etc/cryptswap
+ installer uses /dev/dm-* in /etc/crypttab
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.