Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 863767

Summary: sys-kernel/genkernel-4.2.6-r6: initramfs can't mount rootfs if mdadm raid is in degraded state
Product: Gentoo Hosted Projects Reporter: Grigoriy Puzankin <gpuzankin>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Grigoriy Puzankin 2022-08-05 09:21:36 UTC
Genkernel generates an initramfs. It lacks the functionality to run degraded mdadm arrays.

Reproducible: Always

Steps to Reproduce:
1. Put mdadm raid1 in degraded state (by removing 1 of 2 drives).
2. Then reboot the system.
3. Initramfs reports that it can't find rootfs, prompts user to type "shell" for a shell, "q" to skip.
Actual Results:  
Initramfs reports that it can't find rootfs, prompts user to type "shell" for a shell, "q" to skip.

Expected Results:  
Degraded raid1 should be assembled with 1 of 2 drives. Normal boot order.

Looks like initramfs assembles mdadm arrays using udev rules with --incremental command to mdadm. Once it finds a block device like /dev/sd* it tries to add disk/partition to mdadm array. Array becomes active after adding all disks/partitions to it.

In my case raid1 is degraded, udev adds only one partition to it and leaves the array in inactive state. There're no other scripts or actions that could run a degraded array.

In order to continue booting I have to enter recovery shell (prompted by initramfs). Then execute:
mdadm --stop /dev/md3
mdadm --assemble --run /dev/md3

Another workaround is to patch genkernel's initrd.scripts to re-assemble all arrays according to mdadm.conf.

This is critical for servers, since the remote access will be lost upon reboot.