arighi / virtme-ng

Quickly build and run kernels inside a virtualized snapshot of your live system
GNU General Public License v2.0
351 stars 35 forks source link

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) #108

Closed enlighten5 closed 4 months ago

enlighten5 commented 4 months ago

Hi,

I am getting the following kernel panic when booting a customized kernel in a docker.

The command I am using is vng --arch x86_64 --name testdev --memory 2048M --kimg ./arch/x86/boot/bzImage --mods=auto --rwdir . --pwd --verbose --show-command --show-boot-console --kopt mitigations=off --cpus 2 The qemu version is QEMU emulator version 6.2.0

can you please advise? thanks!

9pnet_virtio: no channels available for device /dev/root
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -2
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 6.1.54 #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x2c/0x3b
 panic+0x20e/0x41c
 ? panic_print_sys_info.part.0+0x57/0x57
 mount_block_root+0x1c5/0x282
 ? init_rootfs+0x2e/0x2e
 ? mount_root+0x53/0x1b5
 ? getname_kernel+0xdc/0x2a0
 ? rest_init+0x170/0x170
 ? rest_init+0x170/0x170
 prepare_namespace+0x131/0x160
 ? rest_init+0x170/0x170
 kernel_init+0x15/0x150
 ? rest_init+0x170/0x170
 ret_from_fork+0x1f/0x30
 </TASK>
Kernel Offset: disabled
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
matttbe commented 4 months ago

Hi,

The error says that the kernel cannot handle the root filesystem. It likely means that either you didn't compile the kernel with the required kernel config (vng 1.23 will not override an existing .config file except if --kconfig is used: if you had an old version, rename or delete it the .config file, then rebuild) or the FS you need is built in a module, and you don't have access to them from the docker.

enlighten5 commented 4 months ago

Hi @matttbe

Thank you for your help!

I tried to use vng to generate a default config and still got the same error.

what would be the built-in module that need to be passed into the container?

Another error message that might be relevant: virtme: waiting for virtiofsd to start fuse: invalid argument /tmp/virtmeb0wjp1t8

Thanks!

matttbe commented 4 months ago

It looks like there is an issue with virtiofs. You can check with vng --force-9p (...) to see if it changes something.

enlighten5 commented 4 months ago

I figured it should be related to the configs I used from virtme and some changes I made to the kernel. vng -r works well on on a clean kernel. Thanks @matttbe.