[pkg-cryptsetup-devel] Bug#781955: cryptsetup: lower case uuid in /etc/crypttab "breaks" parse_options in cryptroot in initramfs.

Sam Tavakoli sam at tavakoli.se
Sun Apr 5 14:49:22 UTC 2015


Package: cryptsetup
Version: 2:1.4.3-4
Severity: minor


If /etc/crypttab source device has uuid set to lower case update-initramfs -u won't complain but in initramfs at boot cryptroot will fail to find the source address due hardcoded comparison in parse_options:

	for x in $cryptopts; do
		case $x in
		...
		source=*)
			cryptsource=${x#source=}
			if [ ${cryptsource#UUID=} != $cryptsource ]; then
				cryptsource="/dev/disk/by-uuid/${cryptsource#UUID=}"
			elif ...
			fi
			export CRYPTTAB_SOURCE="$cryptsource"
			;;

What would happen is cryptsource is still the uuid=xyz string and [ -e ] comparisons in cryptroot fails and script assumes the source device is not available. 

	if [ ! -e "$cryptsource" ]; then
		log_begin_msg "Waiting for encrypted source device..."
		...

This would leave the system hanging in initramfs.


I couldn't find where the /etc/crypttab file is being read at update-initramfs hook for cryptroot. But perhaps the hook should abort or WARN if the UUID is given in lower case since this is the definition in manual page of crypttab. If not then parse_options should be able to deal with uuid in lower case as well.



-- Package-specific info:
-- /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.2.0-4-amd64 root=/dev/mapper/wintermute-root ro ip=5.9.63.104::5.9.63.97:255.255.255.224::eth0:none quiet

-- /etc/crypttab
# <target name>	<source device>		<key file>	<options>
md1_crypt UUID=7873e1e2-1b46-4b27-ac9f-a7488480fb2b none luks

-- /etc/fstab
# /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> <notes>
UUID=ac508826-de03-4bcc-9113-9d0602a3382b       /               ext4    defaults        0       1       # /dev/mapper/wintermute-root
UUID=0b258d05-b772-4b2e-abb8-2d024b0db806       /boot           ext2    defaults        0       2       # /dev/md0 raid 1
UUID=d68324e7-e91b-47c6-a7cb-293b1e15bc27       none            swap    sw              0       0       # /dev/mapper/wintermute-swap_1
UUID=619fa616-7bf8-4bc5-9a81-268905986b67       /store          ext4    defaults        0       1       # /dev/mapper/wintermute-store

-- lsmod
Module                  Size  Used by
nfsd                  216181  2 
nfs                   308353  0 
nfs_acl                12511  2 nfs,nfsd
auth_rpcgss            37143  2 nfs,nfsd
fscache                36739  1 nfs
lockd                  67306  2 nfs,nfsd
sunrpc                173730  6 lockd,auth_rpcgss,nfs_acl,nfs,nfsd
bridge                 70603  0 
stp                    12437  1 bridge
ext2                   59231  1 
snd_pcm                68083  0 
snd_page_alloc         13003  1 snd_pcm
snd_timer              22917  1 snd_pcm
snd                    52893  2 snd_timer,snd_pcm
soundcore              13065  1 snd
i915                  378651  1 
drm_kms_helper         31370  1 i915
acpi_cpufreq           12935  0 
eeepc_wmi              12564  0 
mperf                  12453  1 acpi_cpufreq
asus_wmi               18726  1 eeepc_wmi
sparse_keymap          12760  1 asus_wmi
rfkill                 19012  1 asus_wmi
pcspkr                 12579  0 
drm                   183952  2 drm_kms_helper,i915
i2c_i801               16870  0 
i2c_algo_bit           12841  1 i915
coretemp               12898  0 
evdev                  17562  0 
i2c_core               23876  5 i2c_algo_bit,i2c_i801,drm,drm_kms_helper,i915
iTCO_wdt               17081  0 
iTCO_vendor_support    12704  1 iTCO_wdt
wmi                    13243  1 asus_wmi
processor              28149  1 acpi_cpufreq
video                  17683  1 i915
button                 12937  1 i915
ext4                  350804  2 
crc16                  12343  1 ext4
jbd2                   62115  1 ext4
mbcache                13114  2 ext4,ext2
sha256_generic         16797  2 
dm_crypt               22586  1 
dm_mod                 63645  12 dm_crypt
raid1                  30714  2 
md_mod                 87742  3 raid1
sg                     25874  0 
sd_mod                 36136  6 
crc_t10dif             12348  1 sd_mod
xhci_hcd               73352  0 
crc32c_intel           12747  0 
ghash_clmulni_intel    13130  0 
aesni_intel            50667  24 
aes_x86_64             16843  1 aesni_intel
ahci                   24997  4 
libahci                22941  1 ahci
libata                140630  2 libahci,ahci
fan                    12674  0 
thermal                17383  0 
thermal_sys            18040  4 thermal,fan,video,processor
r8169                  47008  0 
scsi_mod              162321  3 libata,sd_mod,sg
mii                    12675  1 r8169
ehci_hcd               40249  0 
aes_generic            33026  2 aes_x86_64,aesni_intel
cryptd                 14517  10 aesni_intel,ghash_clmulni_intel
usbcore               128741  3 ehci_hcd,xhci_hcd
usb_common             12354  1 usbcore


-- System Information:
Debian Release: 7.8
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cryptsetup depends on:
ii  cryptsetup-bin         2:1.4.3-4
ii  debconf [debconf-2.0]  1.5.49
ii  dmsetup                2:1.02.74-8
ii  libc6                  2.13-38+deb7u8

Versions of packages cryptsetup recommends:
ii  busybox                                 1:1.20.0-7
ii  console-setup                           1.88
ii  initramfs-tools [linux-initramfs-tool]  0.109.1
ii  kbd                                     1.15.3-9

Versions of packages cryptsetup suggests:
pn  dosfstools              <none>
ii  liblocale-gettext-perl  1.05-7+b1

-- debconf information:
  cryptsetup/prerm_active_mappings: true



More information about the pkg-cryptsetup-devel mailing list