View previous topic :: View next topic |
Author |
Message |
bookwood Tux's lil' helper


Joined: 06 Oct 2005 Posts: 136 Location: Dortmund
|
Posted: Tue Jun 24, 2025 8:01 am Post subject: [solved] Dracut with grub raid1 and lvm fails to boot |
|
|
Hi all,
I'm currently migrating from genkernel to dracut using the gentoo-kernel package (i.e. kernel built via emerge gentoo-kernel). The system uses software RAID (mdadm) and LVM for the root filesystem.
After replacing genkernel with dracut and rebuilding the initramfs, the system consistently drops into the dracut emergency shell during boot. To proceed, I have to manually run:
Code: | mdadm --assemble --scan
lvm vgchange -a y
exit
|
After that, the system boots fine.
I've verified that /etc/mdadm.conf exists and is valid, and mdadmconf="yes" is set in my dracut config. I also have add_dracutmodules+=" mdraid lvm " and hostonly="yes" configured.
Here is my /etc/dracut.conf
Code: | # PUT YOUR CONFIG IN separate files
# in /etc/dracut.conf.d named "<name>.conf"
# SEE man dracut.conf(5) for options
# Setze die Boot-Optionen
boot=1
# build initrd only to boot current hardware
hostonly="yes"
hostonly_cmdline="no"
# Aktiviere RAID und LVM
add_drivers+=" mdraid lvm "
add_dracutmodules+=" mdraid lvm "
# Setze die Module für das Root-Dateisystem
filesystems+=" xfs " # Ersetze ext4 durch dein tatsächliches Dateisystem, falls nötig
# Optional: Füge zusätzliche Optionen hinzu
early_microcode="no"
compress="lz4"
mdadmconf="yes"
|
And my grub.cfg
Code: | # cat /etc/default/grub | grep -v ^#
GRUB_DISTRIBUTOR="Gentoo"
GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/mapper/vg-root rd.lvm=1 rd.md=1 rd.scsi.wait_scan=1"
GRUB_DISABLE_LINUX_PARTUUID=false
GRUB_PRELOAD_MODULES="raid mdraid lvm mdraid1x mdraid09"
|
However, dracut still does not assemble the RAID or activate the LVM volumes on its own. The kernel is built using gentoo-kernel, so CONFIG_MD=y and related RAID drivers are built-in (not as modules). I use the original gentoo-kernel package.
The issue seems related to dracut not recognizing the RAID setup during early boot, possibly due to the lack of a specific boot parameter or missing module inclusion logic when everything is built-in.
I'd appreciate any advice on what might be missing in my setup to get dracut to fully assemble and activate the root volume automatically.
Thanks!
Last edited by bookwood on Wed Jun 25, 2025 8:15 am; edited 1 time in total |
|
Back to top |
|
 |
bookwood Tux's lil' helper


Joined: 06 Oct 2005 Posts: 136 Location: Dortmund
|
Posted: Tue Jun 24, 2025 8:03 pm Post subject: |
|
|
I activated the serial console to record the boot messages:
Code: | [ 5.932413] Freeing unused decrypted memory: 2028K
[ 5.945651] Freeing unused kernel image (initmem) memory: 4996K
[ 5.957642] Write protecting the kernel read-only data: 40960k
[ 5.970806] Freeing unused kernel image (rodata/data gap) memory: 1280K
[ 6.072967] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[ 6.085912] Run /init as init process
[ 6.214925] dracut: dracut-106
Starting systemd-udevd version 255
[ 6.456439] dracut: rd.md=0: removing MD RAID activation
[ 6.751320] nv_tco: NV TCO WatchDog Timer Driver v0.01
[ 6.763370] sata_nv 0000:00:0e.0: enabling device (0005 -> 0007)
[ 6.778029] nv_tco: Watchdog reboot not detected
[ 6.782350] ACPI: \_SB_.PCI0.LPC_.LNKN: Enabled at IRQ 21
[ 6.787387] nv_tco: initialized (0x1440). heartbeat=30 sec (nowayout=0)
[ 6.811372] scsi host0: pata_amd
[ 6.817972] sata_nv 0000:00:0e.0: Using SWNCQ mode
[ 6.829627] scsi host1: pata_amd
[ 6.838225] ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0x8c00 irq 14 lpm-pol 0
[ 6.853906] ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x8c08 irq 15 lpm-pol 0
[ 6.872238] scsi host2: sata_nv
[ 6.885438] scsi host3: sata_nv
[ 6.895024] ata3: SATA max UDMA/133 cmd 0x8c40 ctl 0x8c34 bmdma 0x8c10 irq 21 lpm-pol 0
[ 6.911042] ata4: SATA max UDMA/133 cmd 0x8c38 ctl 0x8c30 bmdma 0x8c18 irq 21 lpm-pol 0
[ 6.931458] ACPI: \_SB_.PCI0.LPC_.LNKO: Enabled at IRQ 20
[ 6.942336] sata_nv 0000:00:0f.0: Using SWNCQ mode
[ 6.952753] scsi host4: sata_nv
[ 6.959462] scsi host5: sata_nv
[ 6.965877] ata5: SATA max UDMA/133 cmd 0x8c58 ctl 0x8c4c bmdma 0x8c20 irq 20 lpm-pol 0
[ 6.981887] ata6: SATA max UDMA/133 cmd 0x8c50 ctl 0x8c48 bmdma 0x8c28 irq 20 lpm-pol 0
[ 7.306442] ata5: SATA link down (SStatus 0 SControl 300)
[ 7.386596] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 7.401514] ata3.00: ATA-7: Hitachi HDT725025VLA380, V5DOA52A, max UDMA/133
[ 7.415431] ata3.00: 488397168 sectors, multi 16: LBA48 NCQ (depth 31/32)
[ 7.433756] ata3.00: configured for UDMA/133
[ 7.442568] scsi 2:0:0:0: Direct-Access ATA Hitachi HDT72502 A52A PQ: 0 ANSI: 5
[ 7.459369] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 7.460095] sd 2:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[ 7.484983] sd 2:0:0:0: [sda] Write Protect is off
[ 7.494613] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 7.512742] sd 2:0:0:0: [sda] Preferred minimum I/O size 512 bytes
[ 7.588660] sda: sda1 sda2 sda3
[ 7.595523] sd 2:0:0:0: [sda] Attached SCSI disk
[ 7.929925] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 7.944848] ata4.00: ATA-7: Hitachi HDT725025VLA380, V5DOA52A, max UDMA/133
[ 7.958764] ata4.00: 488397168 sectors, multi 16: LBA48 NCQ (depth 31/32)
[ 7.977090] ata4.00: configured for UDMA/133
[ 7.985841] scsi 3:0:0:0: Direct-Access ATA Hitachi HDT72502 A52A PQ: 0 ANSI: 5
[ 8.002556] sd 3:0:0:0: Attached scsi generic sg1 type 0
[ 8.006652] sd 3:0:0:0: [sdb] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[ 8.028178] sd 3:0:0:0: [sdb] Write Protect is off
[ 8.037804] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 8.055941] sd 3:0:0:0: [sdb] Preferred minimum I/O size 512 bytes
[ 8.108874] sdb: sdb1 sdb2 sdb3
[ 8.115709] sd 3:0:0:0: [sdb] Attached SCSI disk
[ 8.319807] ata6: SATA link down (SStatus 0 SControl 300)
[ 9.839946] floppy0: no floppy controllers found
[ 212.090869] dracut Warning: Could not boot.
dracut Warning: Could not boot.
[ 212.111493] dracut Warning: /dev/mapper/vg1-root does not exist
dracut Warning: /dev/mapper/vg1-root does not exist
Generating "/run/initramfs/rdsosreport.txt"
[ 212.836552] random: crng init done
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.
To get more debug information in the report,
reboot with "rd.debug" added to the kernel command line.
Dropping to debug shell.
dracut:/# mdadm --assemble --scan
mdadm: Value "h2676543:3" cannot[ 323.096940] md: md3 stopped.
be set as devname. Reason: Not POSIX compatible. Value ignored.
[ 323.184807] md/raid1:md3: active with 2 out of 2 mirrors
[ 323.210950] md3: detected capacity change from 0 to 487743488
mdadm: /dev/md/3 has been started with 2 drives.
[ 323.407886] md: md126 stopped.
[ 323.459242] md/raid1:md126: active with 2 out of 2 mirrors
[ 323.470270] md126: detected capacity change from 0 to 384896
mdadm: /dev/md/126_0 has been started with 2 drives.
dracut:/# lvm vgchange -a y
20 logical volume(s) in volume group "vg1" now active
dracut:/# exit
logout[ 357.216897] XFS (dm-0): Deprecated V4 format (crc=0) will not be supported after September 2030.
[ 357.251398] XFS (dm-0): Mounting V4 Filesystem 34a5c705-31a5-4f18-b687-806e1dc72cb9
[ 357.450610] XFS (dm-0): Ending clean mount
[ 357.548865] dracut: Remounting /dev/mapper/vg1-root with -o noatime,logbufs=8,logbsize=256k,ro
[ 357.599198] dracut: Mounted root filesystem /dev/mapper/vg1-root
[ 357.660543] dracut: Mounting /usr with -o noatime,logbufs=8,logbsize=256k,ro
[ 357.706613] XFS (dm-1): Mounting V4 Filesystem 155ff730-b1f5-4f06-90da-6677687bafd4
[ 357.846437] XFS (dm-1): Starting recovery (logdev: internal)
[ 358.108257] XFS (dm-1): Ending recovery (logdev: internal)
[ 358.265154] dracut: Switching root
INIT: version 3.09 booting
OpenRC 0.56 is starting up Gentoo Linux (x86_64)
* /proc is already mounted
* /run/openrc: creating directory
* /run/lock: correcting mode
* /run/lock: correcting owner
* Caching service dependencies ...
[ ok ]
* Mounting security filesystem ...
|
The line Code: | dracut: rd.md=0: removing MD RAID activation | has my attention. It seems that dracut is disabeling raid detection, but I switched it on in my GRUB_CMD_LINE, strange. |
|
Back to top |
|
 |
bookwood Tux's lil' helper


Joined: 06 Oct 2005 Posts: 136 Location: Dortmund
|
Posted: Wed Jun 25, 2025 8:12 am Post subject: |
|
|
I found the root cause of the problem:
Although I had rd.md=1 in my kernel command line, dracut still did not automatically assemble my software RAID array on boot. As a result, I always dropped into the dracut emergency shell and had to run:
Code: | mdadm --assemble --scan
lvm vgchange -a y
exit |
This was required on every boot in order to mount the root filesystem and continue.
---
Solution:
Adding the kernel parameter: rd.auto=1 to my GRUB_CMDLINE_LINUX solved the issue.
Dracut now correctly detects and assembles the RAID and activates LVM volumes automatically. My final working GRUB config looks like this:
Code: | GRUB_CMDLINE_LINUX="root=/dev/mapper/vg1-root rd.auto=1 rootfstype=xfs console=tty0 console=ttyS0,57600"
|
Then I regenerated GRUB:
Code: | grub-mkconfig -o /boot/grub/grub.cfg |
Now the system boots cleanly without any manual intervention.
I’d also like to add that rd.auto=1 seems to be a kind of "universal fallback" for dracut-based initramfs setups. It tells dracut to automatically activate all detected storage layers, including software RAID (mdadm), LVM, encrypted devices (LUKS), multipath, etc. In my case, even though I explicitly had rd.md=1 and rd.lvm=1, dracut still failed to activate the array. Only after adding rd.auto=1 did it start working reliably. I couldn’t find this documented clearly in the Gentoo Handbook or dracut-related Gentoo docs, but it makes a big difference — especially when moving from genkernel to dracut with gentoo-kernel. For anyone experiencing strange boot failures or being dropped into the dracut shell with RAID/LVM, this option is definitely worth trying.
---
Hope this helps someone else running into similar dracut + mdadm + LVM issues on Gentoo with the new gentoo-kernel setup. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|