installer uses /dev/dm-* in /etc/crypttab
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/
cryptswap1 /dev/dm-2 /dev/urandom swap,cipher=
from /var/log/
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!
summary: |
- installer uses /dev/dm-* in /etc/cryptswap + installer uses /dev/dm-* in /etc/crypttab |
Maybe this will help stabilize the device names in /etc/crypttab
--- /tmp/ecryptfs- setup-swap 2013-05-01 21:06:55.750474891 -0400 ecryptfs- setup-swap 2013-05-01 21:58:43.249884148 -0400 cryptswap$ i" ] || break aes-cbc- essiv:sha256" >> /etc/crypttab aes-cbc- essiv:sha256" >> /etc/crypttab
+++ /usr/bin/
@@ -161,7 +161,7 @@
[ -e "/dev/mapper/
done
# Add crypttab entry
- echo "cryptswap$i $swap /dev/urandom swap,cipher=
+ echo "cryptswap$i $(findfs UUID=$uuid) /dev/urandom swap,cipher=
# Add fstab entry cryptswap$ i none swap sw 0 0" >> /etc/fstab
echo "/dev/mapper/