[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#597969: initramfs-tools: md device detection does not work with large numbers of md devices

Package: initramfs-tools
Version: 0.92o
Severity: important

When updating a kernel on a lenny system recently we saw the following

update-initramfs: Generating /boot/initrd.img-2.6.26-2-xen-amd64
mkinitramfs: missing raid root /dev/mapper/local0-sys.root /sys entry
mkinitramfs: workaround is MODULES=most
mkinitramfs: Error please report the bug
update-initramfs: failed for /boot/initrd.img-2.6.26-2-xen-amd64

This was caused by a sequence of bugs, of which this describes the
first (and easiest to fix)

On line 259 of /usr/share/initramfs-tools/hook-functions is found:

block=$(awk "/^${block}/{print substr(\$5, 1, 4); exit}" \

In this case, this command found not md1, as desired, but md11.

The full line found was:

md11 : active (auto-read-only) raid1 sdm1[0] sdn1[1]

This is easily fixed with the following patch:

--- /usr/share/initramfs-tools/hook-functions   2008-12-18 16:41:11.000000000 +0000
+++ hook-functions      2010-09-23 17:31:56.000000000 +0100
@@ -256,7 +256,7 @@
# lvm on md or luks on md
                if [ "${block#md}" != "${block}" ]; then
-                       block=$(awk "/^${block}/{print substr(\$5, 1, 4); exit}" \
+                       block=$(awk "/^${block} /{print substr(\$5, 1, 4); exit}" \

Subsequent bugs which were exposed by this one:

2) In this case md11 is marked auto-read-only (because it has not been
written to) which means that the fifth column is not a component device
name, but the raid level
3) the substr use here would presumably break discovery of component
devices with something other than exactly four characters.

but I'm not sure it's worth filing separate bugs for them, especially
since it looks like it's all changed in sid/sqeeze.

Reply to: