Bug#541234: initramfs-tools: legacylvm misses 'lvm' required by cryptroot

2009-08-12 Thread Robert Burrell Donkin
Package: initramfs-tools
Version: 0.92o
Severity: important
Tags: patch


Regenerate the initramfs using update-initramfs on Lenny without lvm2 with 
encrypted root results in an unbootable image. Investigation showed that 
/usr/share/initramfs-tools/scripts/local-top/cryptroot requires 'lvm'
but /usr/share/initramfs-tools/hooks/legacylvm copies only vgchange.

The patch which follows fixed this for me.  

--- legacylvm   2009-08-12 09:45:45.0 +0100
+++ /usr/share/initramfs-tools/hooks/legacylvm  2009-08-12 09:46:19.0 
+0100
@@ -21,6 +21,7 @@
 if [ -x /sbin/vgchange ]  [ -d /lib/lvm-200 ] \
 [ ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then
copy_exec /lib/lvm-200/vgchange /sbin
+copy_exec /lib/lvm-200/lvm /sbin
for x in dm_mod dm_snapshot dm_mirror; do
manual_add_modules ${x}
done

-- Package-specific info:
-- /proc/cmdline
root=/dev/mapper/thebes-root ro 

-- /proc/filesystems
ext3

-- lsmod
Module  Size  Used by
battery10180  0 
ppdev   6500  0 
lp  8164  0 
acpi_cpufreq6796  0 
cpufreq_powersave   1856  0 
cpufreq_stats   3776  0 
cpufreq_ondemand6476  2 
cpufreq_conservative 5960  0 
cpufreq_userspace   3172  0 
freq_table  4224  3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
ipv6  235364  45 
loop   12748  0 
parport_pc 22500  1 
parport30988  3 ppdev,lp,parport_pc
snd_hda_intel 325688  0 
snd_pcm_oss32832  0 
pcspkr  2432  0 
snd_mixer_oss  12320  1 snd_pcm_oss
iTCO_wdt9508  0 
snd_pcm62596  2 snd_hda_intel,snd_pcm_oss
i2c_i8017920  0 
i2c_core   19828  1 i2c_i801
rng_core3940  0 
snd_seq_dummy   2660  0 
snd_seq_oss24992  0 
snd_seq_midi5728  0 
snd_rawmidi18528  1 snd_seq_midi
snd_seq_midi_event  6432  2 snd_seq_oss,snd_seq_midi
snd_seq41456  6 
snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer  17800  2 snd_pcm,snd_seq
snd_seq_device  6380  5 
snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd45604  9 
snd_hda_intel,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
button  6096  0 
intel_agp  22556  1 
agpgart28776  1 intel_agp
soundcore   6368  1 snd
snd_page_alloc  7816  2 snd_hda_intel,snd_pcm
evdev   8000  3 
ext3  105512  6 
jbd39444  1 ext3
mbcache 7108  1 ext3
sha256_generic 11360  0 
aes_i5867744  2 
aes_generic29256  1 aes_i586
cbc 3264  1 
dm_crypt   11172  1 
crypto_blkcipher   15236  3 cbc,dm_crypt
dm_mirror  15104  0 
dm_log  8484  1 dm_mirror
dm_snapshot14340  0 
dm_mod 46184  19 dm_crypt,dm_mirror,dm_log,dm_snapshot
sd_mod 22200  3 
ide_pci_generic 3908  0 [permanent]
ata_piix   14180  2 
piix6568  0 [permanent]
ide_core   96136  2 ide_pci_generic,piix
floppy 47748  0 
ata_generic 4676  0 
libata140416  2 ata_piix,ata_generic
scsi_mod  129324  2 sd_mod,libata
skge   33360  0 
dock8304  1 libata
ehci_hcd   28396  0 
uhci_hcd   18672  0 
usbcore   118224  3 ehci_hcd,uhci_hcd
thermal15228  0 
processor  32544  2 acpi_cpufreq,thermal
fan 4164  0 
thermal_sys10856  3 thermal,processor,fan

-- /etc/kernel-img.conf
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = update-grub
postrm_hook   = update-grub

-- /etc/initramfs-tools/initramfs.conf
MODULES=most
BUSYBOX=y
KEYMAP=n
BOOT=local
DEVICE=eth0
NFSROOT=auto

-- /etc/crypttab
sdb5_crypt /dev/disk/by-uuid/3556be3d-b1c5-4db5-89ef-ad69e1d36219 none luks


-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages initramfs-tools depends on:
ii  cpio  2.9-13 GNU cpio -- a program to manage ar
ii  findutils 4.4.0-2utilities for finding files--find,
ii  klibc-utils   1.5.12-2   small utilities built with klibc f
ii  module-init-tools 3.4-1  tools 

Bug#541248: initramfs-tools: Hard to debug lvm issues in cryptroot script

2009-08-12 Thread Robert Burrell Donkin
Package: initramfs-tools
Version: 0.92o
Severity: normal
Tags: patch


The /usr/share/initramfs-tools/scripts/local-top/cryptroot script used
with encrypted root does not print debugging information when checks fail.
This makes it hard to debug initramfs failures. 

The following patch adds messages to the LVM section and enabled me
to debug issues with legacy lvm on Lenny.

--- cryptroot   2009-08-12 09:03:58.0 +0100
+++ /usr/share/initramfs-tools/scripts/local-top/cryptroot  2009-08-12 
09:07:02.0 +0100
@@ -124,12 +124,19 @@
vg=${1#/dev/mapper/}
 
# Sanity checks
-   if [ ! -x /sbin/lvm ] || [ $vg = $1 ]; then
+   if [ ! -x /sbin/lvm ]; then
+message lvm is not available
+   return 1
+fi
+
+if [ $vg = $1 ]; then
+message Volume group name collision
return 1
fi
 
# Make sure that the device contains at least one dash
if [ ${vg%%-*} = $vg ]; then
+message Expected at least one dash in volumne group device 
name: $vg
return 1
fi

-- Package-specific info:
-- /proc/cmdline
root=/dev/mapper/thebes-root ro 

-- /proc/filesystems
ext3

-- lsmod
Module  Size  Used by
battery10180  0 
ppdev   6500  0 
lp  8164  0 
acpi_cpufreq6796  0 
cpufreq_powersave   1856  0 
cpufreq_stats   3776  0 
cpufreq_ondemand6476  2 
cpufreq_conservative 5960  0 
cpufreq_userspace   3172  0 
freq_table  4224  3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
ipv6  235364  41 
loop   12748  0 
parport_pc 22500  1 
parport30988  3 ppdev,lp,parport_pc
snd_hda_intel 325688  0 
snd_pcm_oss32832  0 
pcspkr  2432  0 
snd_mixer_oss  12320  1 snd_pcm_oss
iTCO_wdt9508  0 
snd_pcm62596  2 snd_hda_intel,snd_pcm_oss
i2c_i8017920  0 
i2c_core   19828  1 i2c_i801
rng_core3940  0 
snd_seq_dummy   2660  0 
snd_seq_oss24992  0 
snd_seq_midi5728  0 
snd_rawmidi18528  1 snd_seq_midi
snd_seq_midi_event  6432  2 snd_seq_oss,snd_seq_midi
snd_seq41456  6 
snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer  17800  2 snd_pcm,snd_seq
snd_seq_device  6380  5 
snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd45604  9 
snd_hda_intel,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
button  6096  0 
intel_agp  22556  1 
agpgart28776  1 intel_agp
soundcore   6368  1 snd
snd_page_alloc  7816  2 snd_hda_intel,snd_pcm
evdev   8000  3 
ext3  105512  6 
jbd39444  1 ext3
mbcache 7108  1 ext3
sha256_generic 11360  0 
aes_i5867744  2 
aes_generic29256  1 aes_i586
cbc 3264  1 
dm_crypt   11172  1 
crypto_blkcipher   15236  3 cbc,dm_crypt
dm_mirror  15104  0 
dm_log  8484  1 dm_mirror
dm_snapshot14340  0 
dm_mod 46184  19 dm_crypt,dm_mirror,dm_log,dm_snapshot
sd_mod 22200  3 
ide_pci_generic 3908  0 [permanent]
ata_piix   14180  2 
piix6568  0 [permanent]
ide_core   96136  2 ide_pci_generic,piix
floppy 47748  0 
ata_generic 4676  0 
libata140416  2 ata_piix,ata_generic
scsi_mod  129324  2 sd_mod,libata
skge   33360  0 
dock8304  1 libata
ehci_hcd   28396  0 
uhci_hcd   18672  0 
usbcore   118224  3 ehci_hcd,uhci_hcd
thermal15228  0 
processor  32544  2 acpi_cpufreq,thermal
fan 4164  0 
thermal_sys10856  3 thermal,processor,fan

-- /etc/kernel-img.conf
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = update-grub
postrm_hook   = update-grub

-- /etc/initramfs-tools/initramfs.conf
MODULES=most
BUSYBOX=y
KEYMAP=n
BOOT=local
DEVICE=eth0
NFSROOT=auto

-- /etc/crypttab
sdb5_crypt /dev/disk/by-uuid/3556be3d-b1c5-4db5-89ef-ad69e1d36219 none luks


-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages initramfs-tools depends on:
ii  cpio