initramfs issues with mdraid/bcache-tools/lvm2 on debian wheezy-backports 3.16
Subsystems (2)
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
lib/udev/bcache-register 2014-10-11 18:27:42.641482307 +0300 renamed from bcache-register 2014-05-10 16:38:21.000000000 +0300 +3 -0
@@ -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
usr/share/initramfs-tools/scripts/local-top/mdadm 2014-10-11 18:15:23.804520521 +0300 renamed from debian/initramfs/script.local-top 2012-08-25 22:29:05.000000000 +0300 +2 -5
@@ -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
Quoted 5 lines · Tero Marttila
part seems to give (based on udev_log="debug" output):
write error: Invalid arument
Quoted 8 lines
without any additional info in dmesg.
However, running the identical command:
/lib/udev/bcache-register/dev/md0by 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
Signature · 4 lines
======================================================================== Ian Pilcher [email protected] -------- "I grew up before Mark Zuckerberg invented friendship" -------- ========================================================================
Quoted 10 lines · Ian Pilcher
Quoted 9 lines · Tero Marttila
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:
Quoted 9 lines
Quoted 4 lines
/lib/udev/bcache-register/dev/md0by 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
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