16

In previous ubuntu versions, adding BOOT_DEGRADED=true to /etc/initramfs-tools/conf.d/mdadm allowed the system to automatically boot when the root filesystem is on a degraded array. This no longer seems to work in 16.04 LTS.

The documentation (https://help.ubuntu.com/lts/serverguide/advanced-installation.html) looks to be outdated; sudo dpkg-reconfigure mdadm no longer asks to allow degraded boots and the bootdegraded=true kernel argument also no longer seems to work. The system always boots into initramfs when the root filesystem array is degraded. From there,mdadm -IRs allows the system to boot.

How do I enable automatic booting when the root filesystem is on a degraded RAID1 array in 16.04LTS?

vdyvp
  • 161

4 Answers4

10

The mentioned bug appears in mdadm 3.3-2ubuntu7 and has been fixed in 3.4-2.

The latest mdadm release for yakkety (16.10) 3.4-4 contains the fix already and is available for 16.10 but not (yet?) for 16.04LTS.

Thus I upgraded mdadm of my 16.04LTS by hand:

wget http://launchpadlibrarian.net/275652884/mdadm_3.4-4_amd64.deb
sudo dpkg -i mdadm_3.4-4_amd64.deb

To verify I

  • shut down the computer
  • unplugged one of the disks/ssd
  • Turn on the computer

Observing the console: Boot from degraded raid array works!

Bug: https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/1635049 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=784070

1

It seems that root cause is /usr/share/initramfs-tools/scripts/local-top/mdadm script absence - on Debian-8 it is included in mdadm package, but was lost in the same package for Ubuntu-16.04 ;-(

So, after I've created its dirty-hack version and recreated initramfs - my test Ubuntu-16.04 LTS server was able to fully boot using the only second HDD from RAID1 array.

#!/bin/sh
# 2016-07-13 andrey@kopeyko.ru - missed mdadm script for Ubuntu-16.04
# see debian8_host:/usr/share/initramfs-tools/scripts/local-top/mdadm for full version

MDADM=/sbin/mdadm 
. /scripts/functions

echo "===>"
cat /proc/mdstat
echo "===>"
log_begin_msg "Assembling all MD arrays"
if $MDADM --assemble --scan --run --auto=yes
then
  log_success_msg "assembled all arrays."
else
  log_warning_msg "failed to assemble all arrays, attempting individual starts"
  for dev in $(cat /proc/mdstat | grep md | cut -d ' ' -f 1)
  do
    log_begin_msg "attempting mdadm --run $dev"
    if $MDADM --run $dev; then
      log_success_msg "started $dev"
    else
      log_failure_msg "failed to start $dev"
    fi
  done
fi
log_end_msg
echo "===>"
cat /proc/mdstat
echo "===>"

sleep 5

# TODO: run mdadm --readwrite /dev/mdN
# if array is in 'auto-read-only' mode
0

I had the same problem with 16.04, the raid array simple refused to get active in its degraded mode.

here is a easy workaround:

  1. create new file: /etc/initramfs-tools/scripts/init-premount/delay_mounting (remember to set the +x)

add

sleep 20 (or whatever seconds you prefer)

  1. create new file: /etc/initramfs-tools/scripts/local-top/mdadm (remember to set the +x)

add the following (force start array, if you have /dev/md0, /dev/md1 and /dev/md2)

mdadm --run /dev/md0
mdadm --run /dev/md1
mdadm --run /dev/md2

then

update-initramfs -k all -u, then you are all set.

Please note that, only 1) is required for 14.04, but it doesn't hurt to do both. other than you may see some warning message such as:

mdadm: failed to run array /dev/md0: Device or resource busy

which is harmless, since it only say that because /dev/md0 is active, you can definitely write smarter script only execute --run when needed.

0

The other answers here have workarounds to fix the problem, but this is a bug with Ubuntu and should be fixed. Here is the bug: https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/1635049

It was fixed previously: https://wiki.ubuntu.com/ReliableRaid