Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#18365 - [mkinitcpio] mdadm hook broken
Attached to Project:
Arch Linux
Opened by Arno (ihad) - Wednesday, 17 February 2010, 00:24 GMT
Last edited by Dan Griffiths (Ghost1227) - Thursday, 18 February 2010, 02:38 GMT
Opened by Arno (ihad) - Wednesday, 17 February 2010, 00:24 GMT
Last edited by Dan Griffiths (Ghost1227) - Thursday, 18 February 2010, 02:38 GMT
|
DetailsDescription: mdadm hook is broken in mkinitcpio
Just wasted some hours to get my box booting again: setup: 4 sata hard disks, raid 5, lvm on top, kernel panic. I don't know why, but the mdadm hook is a link to the raid hook, forcing me to use mdassemble. I was able to crash my raid with it before and don't want to do it again. Solution: 1. boot your box somehow 2. Create a valid /etc/mdadm.conf: $ mdadm --brief --scan <raid-device> >> /dev/mdadm.conf 3. vi(m) /lib/initcpio/hooks/mdadm 4. for brute force add the following lines after mdconfig= (line 5 for me) if [[ -f /etc/mdadm.conf ]] then /bin/mknod /dev/md0 b 9 0 mdadm --assemble /dev/md0 -c ${mdconfig} fi This will at least get you md0, add more mknods for any other raid arrays. md1 will be 9 1, and so on, see <kernel-source>/Documentation/devices.txt 5. vi(m) /etc/mkinitcpio.conf -Add your (s)ata driver to MODULES -MODULES="/bin/mknod /sbin/mdadm" 6. rebuild the initrd. You can force it with: pacman -S kernel26 7. reboot of course /boot and /var need to be mounted for this to work Additional info: * package version(s) mkinitcpio 0.6.2-1 kernel26 2.6.32.8-1 * config and/or log files etc. mdadm.conf: ARRAY /dev/md0 metadata=0.90 UUID=some-uuid I'm sure there has to be a more elegant soution than presented above, but that makes it work if just have one raid array. BTW, it worked for me before the klibc update. Whoever gets this report, feel free to contact me. Steps to reproduce: see above |
This task depends upon
Closed by Dan Griffiths (Ghost1227)
Thursday, 18 February 2010, 02:38 GMT
Reason for closing: Not a bug
Additional comments about closing: Original poster requested close - not a bug
Thursday, 18 February 2010, 02:38 GMT
Reason for closing: Not a bug
Additional comments about closing: Original poster requested close - not a bug
it uses mdassemble from mdadm package and not the klibc one.
Also, the mdadm hook is no link to the raid hook but the other way around. As I said the mdadm hook has barely changed.
You will not get ANY solution to your problem by posting some uneducated random tampering with hooks that makes no sense to a reader. The only way this problem will get solved is if you find out what exactly goes wrong with the original hooks, which seem to work for everyone but you. You will also get no help if you don't even post your mkinitcpio configuration that failed.
Maybe it's PEBKAC indeed. My setup is as follows:
$ cat /proc/partitions
major minor #blocks name
8 0 156290904 sda
8 1 156288321 sda1
8 16 488386584 sdb
8 17 96358 sdb1
8 18 488287642 sdb2
8 32 488386584 sdc
8 33 96358 sdc1
8 34 488287642 sdc2
8 64 488386584 sde
8 65 96358 sde1
8 66 488287642 sde2
8 48 488386584 sdd
8 49 96358 sdd1
8 50 488287642 sdd2
$ cat /proc/cmdline
root=/dev/mapper/raid-root ro
$ cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb2[0] sde2[3] sdd2[2] sdc2[1]
1464862656 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]
unused devices: <none>
When I rebooted my box yesterday, it dropped me to a shell, because the root filesystem could not be mounted. This was not surprising, since the raid was not assembled (the raid456 module was loaded). So I took a look at the mdadm-hook. When I modified the mdadm-hook to have mdadm instead of mdassemble assemble the raid it started working again. It is quite possible that I'm doing something wrong.
Last, but not least: I'm sorry for my harsh tone and posting my wrong solution. I shouldn't write bug reports so late in the evening. It won't happen again.
according to your setup you use lvm2 on top of mdadm, you need to configure this.
MODULES="pata_acpi pata_amd ata_generic scsi_mod sata_nv ahci raid456 dm_mod xfs"
BINARIES=""
FILES=""
HOOKS="base udev autodetect pata scsi sata usbinput keymap mdadm lvm2 filesystems"
So, your configuration looks reasonable. When you are dropped to the emergency shell, are /dev/sd* detected properly? Does running "mdassemble" manually do something there? Does /etc/mdadm.conf look reasonable in the emergency shell?
I don't know anything about RAID setups, I guess tpowa has done more in this context than me. Anyway, trying to run the mdassemble / lvm vgchange -ay commands manually might give you more hints about what is going on.
ARRAY /dev/md0 metadata=0.90 UUID=fba93001:fd6f2edc:6b4cd62c:fd31e028
though I changed it yesterday evening. I don't have the original any more, but IIRC it was
ARRAY /dev/md/0_0 metadata=0.90 UUID=fba93001:fd6f2edc:6b4cd62c:fd31e028
$ ls -l /bin/ldassemble
-rwxr-xr-x 1 root root 7024 Feb 11 20:11 /bin/mdassemble
$ ls -l /sbin/mdassemble
-rwxr-xr-x 1 root root 161216 Feb 7 11:46 /sbin/mdassemble
/bin/mdassemble actually gets included into the initrd, but it doesn't work, and it's also not owned by any package (any more?).
mdassemble: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked (uses shared libs), stripped
$ md5sum mdassemble
70fe3ad318ba342759f5633f2e3f21d4 mdassemble
$ sha1sum mdassemble
b022ac47b946e830986eda67d4d6c2dab97ff59a mdassemble
$ ldd mdassemble
not a dynamic executable
# strings mdassemble
/lib/klibc-UqSadMgryalzKq_XarP9XnQvbXQ.so
[stripped garbage]
/dev/md%s%d
/proc/devices
Block devices:
md: Unknown device name: %s
md: Loading md%s%d: %s
md: starting md%d failed
raid=
noautodetect
partitionable
part
linear
raid0
super-block
/dev/md0
Error: mdp devices detected but no mdp device found!
md: open failed - cannot start array %s
md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)
md: Too few arguments supplied to md=.
md: md=%d, Minor device number too high.
md: md=%s%d, Specified more than once. Replacing previous definition.
md: md=%s%d - too many md initialisations
md: Will configure md%d (%s) from %s, below.
md: Skipping autodetection of RAID arrays. (raid=noautodetect)
(%d,%d)
/sys/block/%s/dev
/sys/block/%s/range
/dev/%s
/dev/
I'm on x86_64, btw.
It worked because explicitly including mdadm into the initrd via BINARIES provided me with an executable that actually ran and assembled the array.
Also, creating the /dev/md0 device node obviously isn't necessary. As you said, the solution is wrong.