Linux – Kernel and QEMU : Unable to mount root fs error

debuggingkernellinuxlinux-kernelqemu

I am trying to run a distro in the virtual disk image with a custom kernel,so that I can experiment and debug the kernel. I followed this to make a disk image and then install Debian to it. Now I tried running distro with the following command:-

qemu-system-i386 -hda debian.img -kernel ../linux-3.6.11/arch/i386/boot/bzImage -append "root=/dev/sda1"

To my dissappointment it simply gives a Kernel panic-not syncing:VFS:unable to mount root fs on unknown-block(8,1). How can I fix the problem?Am I on the right path as far as kernel debugging is concerned?

Best Answer

I don't think you would have to start debugging the kernel right away. This error message means that the kernel is unable to mount the partition you requested to be /. This would happen for example if you gave it an empty disk image (my hunch is this is your case) - the kernel in the VM sees an unpartitioned drive, there is no /dev/sda1 just /dev/sda. To overcome this follow the instructions in the guide you have used - download a bootable ISO image and use it to install system into the VM image. When raw disk image is used, it can be directly partitioned with utilities like gdisk, fdisk or parted.

Another possibility is, that there you are trying to mount a filesystem for which the kernel doesn't have a driver. This usually happens when one uses a kernel, that has most drivers in loadable modules on initrd and the initrd isn't loaded (hence the kernel lacks the ability to understand the particular filesystem).

Related Question