Discussion:
initramfs issues with mdraid/bcache-tools/lvm2 on debian wheezy-backports 3.16
Tero Marttila
2014-10-11 15:42:09 UTC
Permalink
Hi,

I had some difficulty getting an md-raid1 / bcache / lvm stack to boot up
succesfully on the recent debian wheezy-backports 3.16-0.bpo.2-amd64 kernel
with the rootfs on bcache (and a separate /boot).

I ended up having to patch two parts of the initramfs to get it working.
The bcache-tools patch is probably not the correct solution, but I'm not sure
what the exact issue is which causes bcache-register to fail for a newly added
md device..

1)

In bcache-tools, the /dev/md0 udev rule to invoke

/lib/udev/bcache-register /dev/md0

has some timing constraint; namely, during initramfs bootup the

echo "$1" > /sys/fs/bcache/register_quiet

part seems to give (based on udev_log="debug" output):

write error: Invalid arument

without any additional info in dmesg.

However, running the identical command:

/lib/udev/bcache-register /dev/md0

by hand a short while later from within the initramfs prompts works..

I modified bcache-register to include include a sleep, and now the
/dev/bcache0 device registers during boot.

2)

This exposes a related bug within the mdadm initramfs scripts, as per

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644876#85

So the mdadm part of local-top has to wait for udev to settle and the /dev/bcache0
devices to show up before attempting to activate the lvm VGs.

Not a bcache issues, but part of the workaround...

-- Tero Marttila

--- bcache-tools-1.0.7/bcache-register 2014-05-10 16:38:21.000000000 +0300
+++ /lib/udev/bcache-register 2014-10-11 18:27:42.641482307 +0300
@@ -1,4 +1,7 @@
#!/bin/sh
/sbin/modprobe -qba bcache
+
+echo "$0 sleeping for $1 to settle, while we have:" /dev/bcache* >&2; sleep 5
+
test -f /sys/fs/bcache/register_quiet && echo "$1" > /sys/fs/bcache/register_quiet

--- mdadm-3.2.5/debian/initramfs/script.local-top 2012-08-25 22:29:05.000000000 +0300
+++ /usr/share/initramfs-tools/scripts/local-top/mdadm 2014-10-11 18:15:23.804520521 +0300
@@ -97,11 +97,8 @@
done
fi

-if [ -x "$(command -v udevsettle)" ]; then
- verbose && log_begin_msg "Waiting for udev to process events"
- udevsettle 10
- verbose && log_end_msg
-fi
+# XXX: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644876
+wait_for_udev 10

maybe_break post-mdadm
Ian Pilcher
2014-10-16 22:06:25 UTC
Permalink
Post by Tero Marttila
write error: Invalid arument
without any additional info in dmesg.
/lib/udev/bcache-register /dev/md0
by hand a short while later from within the initramfs prompts works..
This sounds like the error I reported back in July:

http://article.gmane.org/gmane.linux.kernel.bcache.devel/2594
--
========================================================================
Ian Pilcher ***@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
Tero Marttila
2014-10-20 09:46:22 UTC
Permalink
Post by Ian Pilcher
Post by Tero Marttila
write error: Invalid arument
without any additional info in dmesg.
/lib/udev/bcache-register /dev/md0
by hand a short while later from within the initramfs prompts works..
http://article.gmane.org/gmane.linux.kernel.bcache.devel/2594
Quite likely, although for whatever reason I didn't see any bcache
register dmesgen. The retry-on-EBUSY approach sounds like it would
resolve this, I'll need to have a go at testing it.

Ref the debian wheezy mdadm-initramfs bug, the udev settle fix would be
required for any solution that makes the udev bcache-register hook wait.
Seems like it has been fixed in jessie mdadm-3.3, but anyone using
mdraid/bcache/lvm on wheezy will require some form of initramfs hacks.

-- Tero Marttila

Loading...