[linux-lvm] Trouble Booting Custom Kernel with QEMU: dracut-initqueue timeout waiting for /dev/sysvg/root

Vishal Chourasia <[email protected]>
Newsgroups dev.linux.lists.linux-lvm
Message-ID <[email protected]>
Hi All,

I hope this email finds you well. I am currently facing an issue with
booting a VM using a custom-compiled kernel and would appreciate your
expertise on the matter.

### Problem Description
I have downloaded the `Fedora-Server-KVM-38-1.6.x86_64.qcow2` image and
successfully booted it using `qemu-system-x86_64`. However, when I try
to boot this VM with a custom-compiled kernel using the `-kernel` flag,
it fails to boot. The root filesystem is on LVM, and it seems the kernel
needs to activate volume groups before mounting the root filesystem.

### Steps Taken
1. Copied `/boot/config-*` from inside the VM and used it to build the
kernel on the host machine.
2. Also tried `make localmodconfig` after copying `/boot/config-*`.
3. Built `initrd.img` using `dracut`.

#### Dracut Command
```bash
dracut initrd.img --kmoddir $INSTALL_MOD_PATH/lib/modules/6.4.0+ 6.4.0+
```

#### Qemu Command
```bash
qemu-system-x86_64 -enable-kvm -nographic -vga none -smp 1 -m 2G \
-kernel arch/x86_64/boot/bzImage -initrd initrd.img -append
"root=/dev/vda3 ro console=ttyS0" \
-device virtio-blk-pci,drive=rootdisk -drive
file=Fedora-Server-KVM-38-1.6.x86_64.qcow2,if=none,cache=none,id=rootdisk,format=qcow2
\
-net nic,model=virtio -net user,hostfwd=tcp::5555-:22
```

### Error Observed
The kernel panics with the following message:
```
[    0.843818] List of all partitions:
[    0.844084] fd00         7340032 vda
[    0.844086]  driver: virtio_blk
[    0.844571]   fd01            1024 vda1
f3137bf4-2cf0-4ef6-98a9-dda32e23ddcd
[    0.844573]
[    0.845269]   fd02         1048576 vda2
3030ca3b-6606-4a8e-a5ee-efdc7858fb64
[    0.845270]
[    0.845976]   fd03         6288384 vda3
416b3009-59d3-4ed1-b126-3cb216aa02f4
[    0.845976]
[    0.846593] fd10        20971520 vdb
[    0.846594]  driver: virtio_blk
[    0.847091] 0b00         1048575 sr0
[    0.847092]  driver: sr
[    0.847545] No filesystem could mount root, tried:
[    0.847546]  ext3
[    0.847906]  ext2
[    0.848060]  ext4
[    0.848220]  fuseblk
[    0.848362]  xfs
[    0.848537]  btrfs
[    0.848674]
[    0.848951] Kernel panic - not syncing: VFS: Unable to mount root fs
on unknown-block(253,3)
[    0.849574] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.4.0+ #3
[    0.850012] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.o4
[    0.850837] Call Trace:
[    0.851109]  <TASK>
[    0.851261]  dump_stack_lvl+0x47/0x60
[    0.851524]  panic+0x178/0x330
[    0.851745]  mount_block_root+0x278/0x280
[    0.852030]  ? __pfx_ignore_unknown_bootoption+0x10/0x10
[    0.852403]  prepare_namespace+0x156/0x180
[    0.852705]  kernel_init_freeable+0x416/0x460
[    0.853031]  ? __pfx_kernel_init+0x10/0x10
[    0.853328]  kernel_init+0x1a/0x140
[    0.853585]  ret_from_fork+0x2c/0x50
[    0.853858]  </TASK>
[    0.854067] Kernel Offset: 0x16000000 from 0xffffffff81000000
(relocation range: 0xffffffff80000000-0xffffffffbfff)
[    0.854866] ---[ end Kernel panic - not syncing: VFS: Unable to mount
root fs on unknown-block(253,3) ]---
```

### Additional Information
- `/etc/fstab` and `lsblk` output are attached for reference.

#### /etc/fstab
```
/dev/mapper/sysvg-root  /                       xfs     defaults        0 0
UUID=2cd18fbf-7705-4a86-8bb8-c18dafdee822 /boot                   ext4
 defaults        1 2
```

#### lsblk
```
NAME           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0             11:0    1 1024M  0 rom
zram0          251:0    0  3.8G  0 disk [SWAP]
vda            252:0    0    7G  0 disk
├─vda1         252:1    0    1M  0 part
├─vda2         252:2    0    1G  0 part /boot
└─vda3         252:3    0    6G  0 part
  └─sysvg-root 253:0    0    6G  0 lvm  /
```

#### lsinitrd initrd.img
```
Image: initrd.img: 49M
========================================================================
Version: dracut-049-223.git20230119.el8

Arguments: --force --kmoddir '$INSTALL_MOD_PATH/lib/modules/6.4.0+ 6.4.0+'

dracut modules:
bash
systemd
systemd-initrd
nss-softokn
i18n
network-manager
network
ifcfg
drm
plymouth
prefixdevname
crypt
dm
kernel-modules
kernel-modules-extra
kernel-network-modules
lvm
resume
rootfs-block
terminfo
udev-rules
biosdevname
dracut-systemd
usrmount
base
fs-lib
memstrack
microcode_ctl-fw_dir_override
shutdown
```

I would be grateful for any guidance or suggestions you could provide to
resolve this issue.


vishal.c

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.