[pkg-cryptsetup-devel] Bug#634109: cryptsetup: initramfs hook: deps determined for lvm on dm-crypt are incomplete

Christian Pernegger pernegger at gmail.com
Sun Jul 17 00:10:22 UTC 2011


Package: cryptsetup
Version: 2:1.1.3-4squeeze2
Severity: normal
Tags: patch


Given a vg with multiple encrypted pvs, only one of which contains the
root lv, the initramfs-hook will only pull in the pv that actually
holds the root lv. Any other pvs in the same vg are not set up to be
decrypted at boot, so the vg remains incomplete and cannot start,
rendering the system unbootable in turn.

The dependencies of an lvm volume should probably not be determined
via dmsetup deps - maybe something along the lines of:


================ UNTESTED, USE AT YOU OWN RISK ================

--- cryptroot.stock     2011-07-17 01:10:26.000000000 +0200
+++ cryptroot   2011-07-17 02:01:32.000000000 +0200
@@ -141,16 +141,16 @@
                return 1
        fi

-       if ! deps=$(dmsetup deps "$node" 2> /dev/null | sed 's/[^:]*: *//;s/[ (]//g;s/)/ /g'); then
+       if ! deps=$(vgs --noheadings -o pv_name $(echo "$node" | cut -d '-' -f1)); then
                echo "cryptsetup: WARNING: failed to find deps for $node" >&2
                return 1
        fi

        # We should now have a list of major,minor pairs, e.g. "3,2 3,3"
        for dep in $deps; do
-               maj=$(echo ${dep%,*} | sed -e "s/^[ \t]*//g")
-               min=$(echo ${dep#*,} | sed -e "s/[ \t]*$//g")
-               depnode=$(dmsetup ls | sed -n "s/\\([^ ]*\\) *($maj, $min)/\\1/p" | sed -e "s/[ \t]*$//")
+#              maj=$(echo ${dep%,*} | sed -e "s/^[ \t]*//g")
+#              min=$(echo ${dep#*,} | sed -e "s/[ \t]*$//g")
+               depnode=$(dmsetup info -c --noheadings -o name "$dep")
                if [ -z "$depnode" ]; then
                        continue
                fi

================ CUT HERE ================


Cheers,

C.  


-- Package-specific info:
-- /proc/cmdline
root=/dev/mapper/mohammed-root ro acpi_enforce_resources=lax 

-- /etc/crypttab
# <target name>	<source device>		<key file>	<options>
md1_crypt	/dev/md1		none		luks
md2_crypt	/dev/md2		none		luks

-- lsmod
Module                  Size  Used by
cn                      4563  1 
acpi_cpufreq            5571  1 
cpufreq_powersave        902  0 
cpufreq_stats           2659  0 
cpufreq_userspace       1992  0 
cpufreq_conservative     5162  0 
binfmt_misc             6431  1 
ext4                  288318  2 
jbd2                   67015  1 ext4
crc16                   1319  1 ext4
ext2                   52905  1 
k10temp                 2715  0 
lm85                   18993  0 
hwmon_vid               1828  1 lm85
coretemp                4325  0 
ipmi_msghandler        26634  0 
snd_pcm                60503  0 
snd_timer              15582  1 snd_pcm
snd                    46526  2 snd_pcm,snd_timer
soundcore               4598  1 snd
i2c_i801                7830  0 
snd_page_alloc          6249  1 snd_pcm
i2c_core               15819  2 lm85,i2c_i801
pcspkr                  1699  0 
psmouse                49937  0 
container               2389  0 
button                  4650  0 
serio_raw               3752  0 
evdev                   7352  3 
i3200_edac              2671  0 
edac_core              29261  2 i3200_edac
shpchp                 26264  0 
pci_hotplug            21203  1 shpchp
processor              29935  1 acpi_cpufreq
ext3                  106630  2 
jbd                    37085  1 ext3
mbcache                 5050  3 ext4,ext2,ext3
sha256_generic          8692  4 
aes_x86_64              7340  4 
aes_generic            25714  1 aes_x86_64
cbc                     2539  2 
dm_crypt               10664  2 
dm_mod                 53706  20 dm_crypt
raid456                44500  1 
async_raid6_recov       5170  1 raid456
async_pq                3479  2 raid456,async_raid6_recov
raid6_pq               77179  2 async_raid6_recov,async_pq
async_xor               2478  3 raid456,async_raid6_recov,async_pq
xor                     4380  1 async_xor
async_memcpy            1198  2 raid456,async_raid6_recov
async_tx                1734  5 raid456,async_raid6_recov,async_pq,async_xor,async_memcpy
raid10                 17809  1 
raid1                  18431  1 
md_mod                 73872  6 raid456,raid10,raid1
sd_mod                 29921  20 
crc_t10dif              1276  1 sd_mod
uhci_hcd               18521  0 
sata_sil24             11185  8 
ahci                   32534  8 
ehci_hcd               32081  0 
libata                133760  2 sata_sil24,ahci
e1000e                110063  0 
scsi_mod              126517  2 sd_mod,libata
thermal                11674  0 
thermal_sys            11942  2 processor,thermal
usbcore               122498  3 uhci_hcd,ehci_hcd
nls_base                6377  1 usbcore


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

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

Versions of packages cryptsetup depends on:
ii  dmsetup                      2:1.02.48-5 The Linux Kernel Device Mapper use
ii  libc6                        2.11.2-10   Embedded GNU C Library: Shared lib
ii  libdevmapper1.02.1           2:1.02.48-5 The Linux Kernel Device Mapper use
ii  libpopt0                     1.16-1      lib for parsing cmdline parameters
ii  libuuid1                     2.17.2-9    Universally Unique ID library

cryptsetup recommends no packages.

Versions of packages cryptsetup suggests:
ii  busybox                       1:1.17.1-8 Tiny utilities for small and embed
pn  dosfstools                    <none>     (no description available)
ii  initramfs-tools [linux-initra 0.98.8     tools for generating an initramfs
ii  udev                          164-3      /dev/ and hotplug management daemo

-- no debconf information





More information about the pkg-cryptsetup-devel mailing list