Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 198892 - boot w/ mdadm fails to find device nodes and also flunks multiple devices
Summary: boot w/ mdadm fails to find device nodes and also flunks multiple devices
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-12 06:03 UTC by Robin Johnson
Modified: 2008-02-14 06:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Additional patch for busybox mdadm (busybox-1.1.3+gentoo-mdadm-r1.patch,1.17 KB, patch)
2007-11-20 12:35 UTC, Javier Miqueleiz
Details | Diff
Additional patch to support 1.1 and 1.2 metadata versions (busybox-1.1.3+gentoo-mdadm3.patch,1014 bytes, patch)
2008-02-11 07:01 UTC, Javier Miqueleiz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-11-12 06:03:23 UTC
Booting on my G5, with domdadm. I have 3 MD devices, md0 = /boot, md1 = /, md2 = LVM.

>> Detected real_root as a md device. Setting up the device node...
mdadm: error opening /dev/md/0: No such file or directory
mdadm: failed to open array
mdadm: error opening /dev/md/1: No such file or directory
mdadm: failed to open array
mdadm: error opening /dev/md/2: No such file or directory
mdadm: failed to open array
>> ...

I changed the /etc/mdadm.conf in the initramfs to use the /dev/mdX names instead of /dev/md/X, and then I found that it only starts the first device listed in the mdadm.conf file.

The /etc/mdadm.conf was generated with the busybox mdadm in the first place, so I guess it fails for the lack of the /dev/md/ directory.
Comment 1 Chris Gianelloni (RETIRED) gentoo-dev 2007-11-13 22:50:45 UTC
OK.  How do I fix it, then?
Comment 2 Javier Miqueleiz 2007-11-18 22:44:35 UTC
Seems a bug with busybox mdadm patch.

The function "int mdassemble_main()" expects the "/dev/md" string (without the trailing /). This function is called to assemble the arrays.

In contrast, the function "brief_examine_super1()" writes "ARRAY /dev/md/". This function is invoked in order to examine the devices (the output of /etc/mdadm.conf comes from this one).

I tried deleting the slash in "brief_examine_super1()". Now works for me. The array is assembled.

There seems to be another bug in the function "int mdassemble_main()". The if condition for creating the node should be based on errno instead of the return value of strtoul(). This function returns a long value (the minor number), not an error condition.

Want to test with more than one array to verify things. But seems pretty clear.

The patch to mdadm is trivial, but can provide it anyway.
Comment 3 Javier Miqueleiz 2007-11-20 12:35:01 UTC
Created attachment 136482 [details, diff]
Additional patch for busybox mdadm
Comment 4 Javier Miqueleiz 2007-11-20 12:53:50 UTC
Attached the patch.

Have tested it creating up to 3 different arrays. All of them are started ok.

Have found problems if the metadata version is 1.1 or 1.2 (haven't tried with the old version 0.9). Only version 1.0 arrays are started.

BTW, sys-fs/mdadm was also affected by a bug similar to this (was fixed in release 2.6.3 though). Perhaps both bugs are related.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-11-20 14:03:18 UTC
I'll try it in 12 hours or so. I have 0.9, 1.0 and 1.1 metadata arrays.

Some mdadm/kernel versions have a glitch that causes them to behave weirdly with metadata 1.0 arrays as well.
Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2007-11-24 15:59:52 UTC
Robin:  any word?
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-11-24 20:57:16 UTC
Ok, it generates the mdadm.conf correctly now, 0.9 metadata works fine, v1.1 is detected, but not assembled: 'no devices found'
Comment 8 Javier Miqueleiz 2007-11-26 20:04:32 UTC
Thank you for testing, Robin ;-).

You confirm we still have some bugs with versions 1.1 and 1.2. Versions 0.9 and 1.0 are working ok. I will have a look at busybox mdadm and try to propose a patch. I expect to do it this week.

BTW, could you be more explicit about that bug regarding some mdadm/kernel versions?

Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-11-26 23:35:30 UTC
For the main mdadm/kernel bugs, boot one of the pre-release 2007.1 media (I ran into the bug on the ppc64 media that I was testing for rangerpb), and try to create a 1.0 array. It will be created, but mdadm will fail to start it. If you then try to assemble it manually using the sysfs interface, you'll get a backtrace in the kernel, and the box hangs in some cases.
That's why my md3 is v1.1 actually. I prefer 1.0 and 0.9, since the superblocks are at the end of the device, so they don't block unmodified booting of a RAID1 device.
I was using real disk, and I'm not sure if it happens with loop devices offhand (it should tho).

(see "man md" for the exact details).
0.9 - superblock located in the last 64-128K of device, 64Kb in size. 
1.0 - superblock located in the last 8-12K of device.
1.1 - at start of device.
1.2 - starting at 4K in the device.
Comment 10 Chris Gianelloni (RETIRED) gentoo-dev 2007-11-28 21:46:49 UTC
I've gone ahead and added this.  I'd rather we support *some* of the versions than none.
Comment 11 Chris Gianelloni (RETIRED) gentoo-dev 2007-11-28 22:32:08 UTC
This should be done in 3.4.9_pre10 which will be hitting the tree soon.
Comment 12 Javier Miqueleiz 2007-11-29 19:46:15 UTC
Seems reasonable to me. We only gain functionality since it doesn't work now.

A fully working version supporting all 4 metadata types could be released in another genkernel revision.

Just my opinion. I would like to hear Robin about this.
Comment 13 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-11-29 20:22:12 UTC
we're only moving forward by including it, no objections from me.
getting there in small steps is a help when doing a big step in one go isn't available.
Comment 14 Javier Miqueleiz 2008-02-11 06:59:48 UTC
Attached a new patch against sys-kernel/genkernel-3.4.9 to support all 4 metadata versions (i.e., 0.9, 1.0, 1.1 and 1.2).

The patch is based on some changes from full mdadm-2.6.2 to mdadm-2.6.3 (so credit should go to Neil Brown).

Have reasonably tested and think it should work fine.
Comment 15 Javier Miqueleiz 2008-02-11 07:01:36 UTC
Created attachment 143185 [details, diff]
Additional patch to support 1.1 and 1.2 metadata versions
Comment 16 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-14 06:10:54 UTC
OK, I added the mdadm3 patch to SVN, so it'll show up in 3.4.10_pre2...