Linux: launching a self-compiled kernel in qemu: VFS: unable to mount root fs on an unknown wn-block (0,0)

I'm trying to run this and don't know what I'm doing wrong. I created Debian.img (a raw format disk with a virtual device manager - gui to libvirt, I think) and installed debian without any problems. Now I want this to run with a self-compiled kernel. I copied the .config file from my working (virtual) debian and made no changes at all. This is what I do:

qemu-system-x86_64 -m 1024M -kernel /path/to/bzImage -hda /var/lib/libvirt/images/Debian.img -append "root=/dev/sda1 console=ttyS0" -enable-kvm -nographic 

But during boot, I always get this error message.

  [ 0.195285] Initializing network drop monitor service [ 0.196177] List of all partitions: [ 0.196641] No filesystem could mount root, tried: [ 0.197292] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) [ 0.198355] Pid: 1, comm: swapper/0 Not tainted 3.2.46 #7 [ 0.199055] Call Trace: [ 0.199386] [<ffffffff81318c30>] ? panic+0x95/0x19e [ 0.200049] [<ffffffff81680f7d>] ? mount_block_root+0x245/0x271 [ 0.200834] [<ffffffff8168112f>] ? prepare_namespace+0x133/0x169 [ 0.201590] [<ffffffff81680c94>] ? kernel_init+0x14c/0x151 [ 0.202273] [<ffffffff81325a34>] ? kernel_thread_helper+0x4/0x10 [ 0.203022] [<ffffffff81680b48>] ? start_kernel+0x3c1/0x3c1 [ 0.203716] [<ffffffff81325a30>] ? gs_change+0x13/0x13 

What am I doing wrong? Please help someone. Do I need to pass the -initrd parameter? I tried it already, but still no luck.

+4
source share
4 answers

I figured it out myself. Some time passed, but as I recall, the solution was to provide an initial ramdisk. This is how I worked with hardware acceleration.

Compilation

 make defconfig CONFIG_EXT4_FS=y CONFIG_IA32_EMULATION=y CONFIG_VIRTIO_PCI=y (Virtualization -> PCI driver for virtio devices) CONFIG_VIRTIO_BALLOON=y (Virtualization -> Virtio balloon driver) CONFIG_VIRTIO_BLK=y (Device Drivers -> Block -> Virtio block driver) CONFIG_VIRTIO_NET=y (Device Drivers -> Network device support -> Virtio network driver) CONFIG_VIRTIO=y (automatically selected) CONFIG_VIRTIO_RING=y (automatically selected) 

---> see http://www.linux-kvm.org/page/Virtio

Include paravirt in config

Disable NMI watchdog in HOST to use performance counters in GUEST. You can ignore it.

 cat /proc/sys/kernel/nmi_watchdog 

---> see http://kvm.et.redhat.com/page/Guest_PMU

Start at Qemu

 sudo qemu-system-x86_64 -m 1024M -hda /var/lib/libvirt/images/DEbian.img -enable-kvm -initrd /home/username/compiled_kernel/initrd.img-3.2.46 -kernel /home/username/compiled_kernel/bzImage -append "root=/dev/sda1 console=ttyS0" -nographic -redir tcp:2222::22 -cpu host -smp cores=2 

Start at KVM

Kernal: / home / username / compiled_kernel / bzImage
Initrd path: /home/username/compiled_kernel/initrd.img-3.2.46
Kernel Arguments: root = / dev / sda1

Hope this helps if someone has the same problems.

+2
source

Your system image file may be bad and cannot be installed. You can try this command to mount the image file and check if it is a valid Linux root file system.

 losetup /dev/loop0 /var/lib/libvirt/images/Debian.img kpartx -av /dev/loop0 mount /dev/mapper/loop0p1 /mnt/tmp 
0
source

Most likely, the kernel does not know the correct device to boot.
This can be explicitly specified from the qemu command line. So, if the root is in section 2, you can say:

 qemu -kernel /path/to/bzImage \ -append root=/dev/sda2 \ -hda /path/to/hda.img \ . . . 

Note that I am using / dev / sda2 , although there is an IDE on the disk. Today, even virtual machines use SATA.

Other possibilities are that, as @Houcheng says, your root FS is damaged, otherwise the kernel does not have this type of FS built in. But I think you will get another error if that were the case.

0
source

QEMU Version

 QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.11), Copyright (c) 2003-2008 Fabrice Bellard 

run build-root 4.9.6 with the following arguments to be passed

 qemu-system-x86_64 -kernel output/images/bzImage -hda output/images/rootfs.qcow2 -boot c -m 128 -append root=/dev/sda -localtime -no-reboot -name rtlinux -net nic -net user -redir tcp:2222::22 -redir tcp:3333::3333 

took only / dev / sda as an option for the root fs to mount (it will show you a little hint for the root fs option after loading it and freezing with the following error):

 VFS: Cannot open root device "hda" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions: 0800 61440 sda driver: sd 
0
source

Source: https://habr.com/ru/post/1487543/


All Articles