Possible data loss caused by cryptdisks_start
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cryptsetup (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: cryptsetup
cryptdisks_start can lead to a data loss:
By upgrading from karmic to lucid device names for harddisks changed. (SATA is now assigned second, IDE first - at least on my system.) After this the original swap partition name (/dev/sda1, now /dev/sdb1) pointed to a windows ntfs filesystem (now /dev/sda1, /dev/sdb1 before).
swapon checks for a swap signature before using a partition, however the device mapper, which the cryptsetup uses for providing encrypted devices, does not check anything, since it simply expects data, which is not interpreted in any way (by the device mapper itself). Resulting from this the device mapper happely provides a data partition for cryptsetup. (In my case it made windows unbootable, but there had been lots of trouble, if my swap usage was higher!)
cryptdisks_start should somehow make sure that such things don't happen. UUIDs can be used without any further checking, but in case of pure device names, it should at least make sure, that the partition ID is 82 (Linux Swap / Solaris) or not accept pure device names at all for swap.
Workaround:
Use UUIDs in /etc/crypttab, this makes sure no wrong partition is used for swap.
In order to check, whether your system is affected use 'free' to check, whether swap size is correct. I myself was able to get windows back to boot, but in other cased, the ntfs filesystem may be damaged much more.
References - I think these errors may be caused by above bug:
http://
https:/
I myself thought, that it was a grub bug first, but I think cryptsetup (cryptdisk_start) is the real problem.
...
Just checked the scripts a bit and it seems, that checking is really done. /sbin/blkid is called by the scripts, but it does return nothing for a swap partition (with an empty label in my case). Maybe this is a bug in /sbin/blkid from util-linux, but I'm not sure, since I don't completly understand the scripts in /lib/cryptsetup/*.
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: cryptsetup 2:1.1.0~
ProcVersionSign
Uname: Linux 2.6.32-21-generic i686
NonfreeKernelMo
Architecture: i386
Date: Sun May 2 19:26:37 2010
ProcEnviron:
PATH=(custom, no user)
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: cryptsetup
crypttab:
# <target name> <source device> <key file> <options>
cryptswap1 UUID=e3d8e700-