Ubuntu 11.10+ with RAID not booting after installing mdadm? read on…

Well after monkeying about with a busted 11.10 installation (call it a learning curve with Linux); I decided to reinstall the OS from fresh. I have 4x2TB drives utilising Ubuntu’s FakeRAID (software RAID), along with a 500Gb OS drive (the target for my refresh).

TL;DR – solution to this problem is at bottom of this post;

After booting from freshly minted 11.10 CD, installing OS with updates, rebooting back into the GUI, all flawless… Only thing missing was my RAID array. So I installed mdadm; a trivial matter… again everything was fine.. Went for another reboot; after getting the ‘loading operating system’ message (which I believe to be the GRUB bootloader) I got a blank screen… nothing…

Hit Ctrl+Alt+Del to force the system to hard reset; after getting to the same point I was greeted with the initramfs CLI; telling me that one of the elements in the RAID array was degraded… brilliant… Typed ‘exit’ to circumvent doing anything nefarious with the initramfs commands, i got back into Ubuntu; checked the disk utility and there was my RAID array. Now slightly baffled I decided to check the integrity of the array… some 23 hours later it all came back checked, synced and verified; no errors.

Now even more puzzled than when I started I proceeded to hit ubuntuforums.org (an invaluable resource IMHO!); standard searches didn’t turn anything useful up, and my post regarding this didn’t really get any interest. I then stumbled upon this gem of a post; after wading through the responses I found a comment from ‘dangriffin’; seems that on large disk arrays; the integrity checks are done before all the disks are detected!

His solution is a very simple one; open a terminal:
[cclN_powershell]
sudo nano /usr/share/initramfs-tools/scripts/mdadm-functions
[/cclN_powershell]

In there, look for the following function:

[cclN_powershell]
degraded_arrays()
{
mdadm –misc –scan –detail –test >/dev/null 2>&1
return $((! $?))
}
[/cclN_powershell]

and change it to:
[cclN_powershell]
degraded_arrays()
{
udevadm settle
mdadm –misc –scan –detail –test >/dev/null 2>&1
return $((! $?))
}
[/cclN_powershell]

then do a:

[cclN_powershell]
update-initramfs -k all -u
[/cclN_powershell]

(Thanks to HÃ¥var Nielsen for the tip of updating all Kernels with the above command!)

Reboot and you should be all set! Seems that adding ‘udevadm settle’ to the function makes the initramfs wait until all the drives are spun up and detected before trying to check their integrity. Lets hope this one gets put in for Ubuntu 12!

TIP 2: I was also getting issues with mdadm –detail; it was reporting a warning like ‘mdadm: only give one device per ARRAY line’; turns out this is another bug! When you create a RAID array it gives it the default name of ‘RAID Array’… this actually screws up the mdadm.conf file; to fix this warning do the following:

[cclN_powershell]
sudo nano /etc/mdadm.conf
[/cclN_powershell]

look for any reference to the name ‘RAID Array’ (I had two references in there); simply remove the space between the name so it becomes ‘RAIDArray’, Ctrl+X to save and Roberts your father’s brother!

One thought on “Ubuntu 11.10+ with RAID not booting after installing mdadm? read on…”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>