Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#57860 - [mdadm] mdadm_udev does not assemble degraded array during boot

Attached to Project: Arch Linux
Opened by Daan van Rossum (drrossum) - Friday, 16 March 2018, 15:03 GMT
Last edited by Dave Reisner (falconindy) - Monday, 07 January 2019, 11:26 GMT
Task Type Bug Report
Category Arch Projects
Status Assigned
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


mkinitcpio's mdadm_udev hook uses mdadm upstream's udev rules to incrementally assemble raid arrays. 64-md-raid-assembly.rules uses systemd.timer to delay starting of partially assembled arrays to fix issues with slow array members (e.g. usb devices). But systemd.timer is not functional in initcpio. In case the array holds the root filesystem this has severe consequences:
- partially assembled array remain "inactive"
- the root FS is not available and does not get mounted
- boot process is interrupted with an emergency shell

From here, the following steps resume the boot process with a degraded array:
# mdadm --incremental --run --scan
# mount /dev/md0 /new_root
# exit

This can be fixed using custom install and hook files for the mdadm_udev hook, see attached.

I think it should be mdadm_udev's default behavior to auto-assemble arrays (that are configured for auto-assembly in mdadm.conf) in degraded mode if necessary, instead of interrupting the boot process.

Additional info:
mkinitcpio 24-2
mdadm 4.0-1

Steps to reproduce:
- Create a md raid-1 array
- move a system's root FS on the raid-1 array
- poweroff, remove one of the raid members
- poweron
- boot fails due to root FS not mounted
This task depends upon

Comment by Daan van Rossum (drrossum) - Friday, 16 March 2018, 15:06 GMT
I believe this fix may be related to  FS#49071 , as the mdadm_udev hook will then only return once the arrays are assembled, in time for the lvm2 hook to start using the lv metadata.
Comment by eaut (eaut) - Sunday, 01 September 2019, 22:07 GMT
The bug is still present and therefore booting from an degraded md-raid device fails.

The way I understand it, the package build file "mdadm_udev_install" misses the following build rules:

add_systemd_unit "mdadm-last-resort@.service"
add_systemd_unit "mdadm-last-resort@.timer"

This makes sure that the required systemd units are copied to the initramfs. They are triggered by 64-md-raid-assembly.rules as described above.
No additional fixes should be required.