Jamie Heilman wrote: > I wouldn't be stunned if this problem mostly stemmed from the fact > that /scripts/init-top/udev executes prior to loading kernel modules. > It might be interesting to see what happens if we toss > udevadm trigger --action=add > udevadm settle || true > into a script in /scripts/init-premount ...
So, I tried that, it works; though I'm not entirely happy with the solution, it seems rather brutish. The init-premount/mdadm script I used was: #!/bin/sh PREREQS="udev" prereqs() { echo "$PREREQS"; } case "$1" in prereqs) prereqs; exit 0 ;; esac udevadm trigger --action=add -s block udevadm settle || true exit 0 What strikes me as annoying about this though, is that the only real change between scripts/init-top/udev running and init-premount/mdadm running, is the load_modules call. I noticed that when I ran modprobe md_mod manually, then ran udevadm trigger --action=add -s block, udev would automatically assemble the array without further complaint, so I figured if I just added: TEST!="[module/md_mod]", RUN{builtin}+="kmod load md_mod" after the md_inc label in 64-md-raid-assembly.rules that I might not need the init-premount/mdadm script at all, and that the array would be assembled automaticaly when init-top/udev ran. So, I tried that too, but it doesn't work for reasons that I haven't figured out yet, maybe due to race conditions or something. If udev can't be used to automatically construct the array, maybe calling mdadm --assemble --scan in an init-premount script really is the better appraoch. Replying all the block device add events seems like it could have unwanted side-effects. Anyway, so there are workarounds, but what the Right Way to fix this is, I'm not sure about. Attached patch takes care of the aforementioned case sensitivity regression. -- Jamie Heilman http://audible.transient.net/~jamie/
--- hooks.mdadm 2016-07-16 07:55:56.057651332 +0000 +++ /usr/share/initramfs-tools/hooks/mdadm 2016-07-16 08:00:25.331825532 +0000 @@ -97,8 +97,8 @@ else # make sure the configuration file knows about all running devices /sbin/mdadm --detail --scan | while read array device params; do - uuid=${params#*UUID=}; uuid=${uuid%% *} - if ! grep -q "UUID=$uuid" $DESTMDADMCONF; then + uuid=`echo "$params" | grep -iom 1 ' uuid=[0-9a-f:]\+'` + if ! grep -qi "$uuid" $DESTMDADMCONF; then warn "the array $device with UUID $uuid" warn "is currently active, but it is not listed in mdadm.conf. if" warn "it is needed for boot, then YOUR SYSTEM IS NOW UNBOOTABLE!"