udev rules for mdadm cause boot hangs and md array malfunctions

Bug #645575 reported by Adalberto
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: udev

Hi,
las week I upgraded ubuntu 9.10 to 10.04, and then installed 2 new hard drives and built a new md0 RAID1 array by means of mdadm, defining also a new mdadm.conf with just one line for md0, and a new entry in fstab for the mount point of md0.
Upon reboot, the boot process stopped saying it couldn't find the device for this new mount point; /proc/mdstat listed this new strange "md_d0" array, inactive, with one of the two drives which were part of my md0.
On further reboots, I noticed the drive "captured" this way by "md_d0" was randomly picked up between the two drives of md0.
This thread here: http://osdir.com/ml/linux-raid/2009-08/msg00219.html directed my to the solution.
So here's the content of my 85-mdadm.rules file, edited in order not to run mdadm --incremental for each and every array member found!!

cat /lib/udev/rules.d/85-mdadm.rules
# This file causes block devices with Linux RAID (mdadm) signatures to
# automatically cause mdadm to be run.
# See udev(8) for syntax
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid*", \
 RUN+="/sbin/mdadm --assemble --scan"
#RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
#AMC100922: caused malfunctions on preconfigured arrays!!

This way it works just fine.
Don't know if this error could be related to the upgrade from 9.10 to 10.04, as I didn't have any md array on 9.10, and only defined it after the upgrade to 10.04.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in udev (Ubuntu):
status: New → Confirmed
Revision history for this message
sungaMagnus (sungam) wrote :

Instead of applying Adalberto's patch

I found this http://ubuntuforums.org/showthread.php?p=11388915 and it works for me
tl;dr there is a race condition between assemble of the raid array and the check on the health of the array.

In file, /usr/share/initramfs-tools/scripts/mdadm-functions

Modify function from:
degraded_arrays()
{
        mdadm --misc --scan --detail --test >/dev/null 2>&1
        return $((! $?))
}

To:
degraded_arrays()
{
        udevadm settle
        mdadm --misc --scan --detail --test >/dev/null 2>&1
        return $((! $?))
}

Revision history for this message
Diego Morales (dgmorales) wrote :

I am not sure if they should be marked as duplicates, but see also https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/1335642 .

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.