How to enable degraded RAID1 boot in 16.04LTS?

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?


Solution 1:

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

Solution 2:

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 [email protected] - 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