post installation handling of raid devices on boot

Bug #617725 reported by Trenton D. Adams on 2010-08-14
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mdadm (Ubuntu)
Undecided
Surbhi Palande

Bug Description

Binary package hint: initramfs-tools

I added raid to my system after installation. /etc/mdadm/mdadm.conf was not updated to reflect my raid devices, and the default configuration is not detecting my raid devices, for whatever reason. As a result, I get an error during boot, saying "ALERT! /dev/mapper/sys-ubuntu does not exist. Dropping to a shell."

At that point, I do the following...
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3
mdadm --assemble /dev/md1 /dev/sda5 /dev/sdb5

Then I logout of the shell, and the system boots normally.

After poking around in /usr/share/initramfs-tools, I found the mdadm hook copies /etc/mdadm/mdadm.conf verbatim. So, I then did this...
mdadm --detail --scan > /etc/mdadm/mdadm.conf
update-initramfs -ck all

My system now boots normally.

Now, I suggest that the following be added to /etc/initramfs-tools/conf.d/mdadm
# GENERATE_CONFIG
# Do you want to generate on /etc/mdadm/mdadm.conf file based on your
# currently running raid arrays?
#
# This is REQUIRED if you did not setup your software raid during
# installation. e.g. You obtained a new drive some time after
# ubuntu installation, and
# decided to raid your system.
#
# essentially we run mdadm --detail --scan > /etc/mdadm/mdadm.conf
GENERATE_CONFIG=true

I then suggest that /usr/share/initramfs-tools/hooks/mdadm be updated to run...
mdadm --detail --scan > /etc/mdadm/mdadm.conf if GENERATE_CONFIG=true.

Any thoughts? Or was there an easier way for me to have my system boot normally?

I'm using 10.04, which I assume was automatically included in the bug report.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: initramfs-tools 0.92bubuntu78
ProcVersionSignature: Ubuntu 2.6.32-24.39-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic x86_64
Architecture: amd64
Date: Sat Aug 14 00:43:28 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
PackageArchitecture: all
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=en_CA.UTF-8
SourcePackage: initramfs-tools

Oh, I'm also thinking, since it is such a minor update, perhaps it could be put in for 10.04 as a patch level update, rather than waiting till the next release of ubuntu?

Colin Watson (cjwatson) wrote :

I think it's obviously the right thing not to require people to do this kind of work by hand if at all possible, but I'm cautious about introducing a new interface for it. In particular, Debian already has code which automatically generates the configuration file if it's absent using '/usr/share/mdadm/mkconf generate /etc/mdadm/mdadm.conf', without requiring anything in the configuration file; this code was removed in Ubuntu as part of a general simplification when we moved to udev for RAID assembly. Maybe we just need to restore that little piece of complexity?

Colin Watson (cjwatson) wrote :

Surbhi, could you have a look at this as part of (or following) your mdadm merge in progress?

Changed in initramfs-tools (Ubuntu):
assignee: nobody → Surbhi Palande (csurbhi)
Colin Watson (cjwatson) on 2010-08-16
affects: initramfs-tools (Ubuntu) → mdadm (Ubuntu)

Colin, yeah, okay, that makes more sense. Perhaps just keeping mkconf in the distro, and only calling it during initramfs is appropriate then?

Surbhi Palande (csurbhi) wrote :

@Trenton D. Adams,

Just to make sure, did you add the raid through the following commands:
1) mdadm --create /dev/md0 --level=<level> --raid-devices=2 /dev/sda3 /dev/sdb3
2) mdadm --create /dev/md1 --level=<level> --raid-devices=2 /dev/sda5 /dev/sdb5
?
If you do this, then you should not have to do anything more that this. Is you /etc/mdadm/mdadm.conf not getting updated inspite of this? Or else, what command did you use to get your raid under md?

Surbhi Palande (csurbhi) wrote :

Seems that this bug is found in cases where old superblocks are found on the disks during mdadm install. I could not see this bug on a fresh disk under fresh Lucid install. Linking this bug to another bug 158918.

Surbhi Palande (csurbhi) wrote :

Please do unmark this as not duplicate, if your disks are fresh. Also, note that I tried to reproduce this on KVM and not on a real machine. Wonder if that made the difference. Thanks!

Yes, I did the commands in comment #6, while the system was running, and my mdadm.conf was not updated. I then did a live pvmove over to the new md device, update-grub, update-initramfs, and rebooted. It wasn't until I did the command to force writing the config to mdadm.conf that it got there.

I'm not sure that the other bug is the same. Mine only occurred when I actually switch to using raid arrays. When I update my mdadm.conf with the appropriate configuration, it just works. But, I'm not an mdadm expert, so it's possibly this is a duplicate of the other one.

Surbhi Palande (csurbhi) on 2010-08-23
Changed in mdadm (Ubuntu):
status: New → In Progress
Surbhi Palande (csurbhi) wrote :

Requesting sponsorship: Attaching a tested patch for mdadm-2.6.7.1. This consists of the code cherry picked from the equivalent file from debian. Please consider merging for Maverick.

P.S: Shall create another patch for mdadm-3.2.1(different changelog). This version is yet not merged in Maverick and so created a separate patch for 3.2.1

What is sponsorship?

Surbhi Palande (csurbhi) wrote :

Trenton D. Adams, someone who has rights for merging the patches in the Ubuntus mdadm package should after reviewing this patch accept it (if it looks ok) and merge it in. So requesting sponsorship means basically requesting someone to review the patch and to merge it in the package.

Michael Vogt (mvo) wrote :

I sponsored it now, sorry that it took so long :/

Changed in mdadm (Ubuntu):
status: In Progress → Fix Committed
Michael Vogt (mvo) wrote :

The diff looks fine, note that I did not test it, I don't have a mdadm configuration.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mdadm - 2.6.7.1-1ubuntu16

---------------
mdadm (2.6.7.1-1ubuntu16) maverick; urgency=low

  * debian/initramfs/hook: Added following code (invoked on update-initramfs)
    (LP: #617725):
    - create a mdadm.conf if it is not found in /etc and copy it in initramfs
    - update an existing mdadm.conf in the initramfs if it does'nt include
      a definition of any array
    - warn the user if the definition of an active array is not found in the
      initramfs/etc/mdadm.conf
 -- Surbhi Palande <email address hidden> Mon, 13 Sep 2010 18:59:03 +0300

Changed in mdadm (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers