Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was trying to study the debugging of kernel using QEMU. I tried initially and failed due to the fact that there was no virtual file system. The answers to this post suggests that there should be a virtual file system. But it doesn't talk about how to create virtual FS for kernel debugging and how to pass it over to the qemu. Can you help me out?

share|improve this question
This blog post describes the use of QEMU to debug the OpenBSD kernel but could still be helpful, just replace the OpenBSD-specific parts with the Linux ones. (The author uses a complete system image to debug the kernel; he doesn't just use a kernel only.) What exactly is the step you're stuck with? – sr_ Jan 13 '13 at 9:49
@sr_ Kernel Panic happens. And the warning says:- Unable to mount root fs on unknown-block(0,0). – PaulDaviesC Jan 13 '13 at 10:05
Try using a minimal filesystem (i.e. try debugging the kernel in its normal environment). What bug is it you're trying to get rid of? (A panic caused by no root file system doesn't quite qualify as a bug (unless what you're trying to do revolves around initrd)) – sr_ Jan 13 '13 at 10:09
I know that does not relate to bug. I am experimenting and not trying to get rid of any bugs as of now :) – PaulDaviesC Jan 13 '13 at 10:23
Here is a way mentioned to debug the Linux kernel using qemu. – user31986 Jan 8 at 10:20
up vote 2 down vote accepted

Depending on the distribution you'd like to use, there are various ways to create a file system image, e.g. this article walks you through the laborious way to a "Linux from Scratch" system.

In general, you'd either create a QEMU image using qemu-img, fetch some distribution's installation media and use QEMU with the installation medium to prepare the image (this page explains the process for Debian GNU/Linux) or use an image prepared by someone else.

This section of the QEMU Wikibook contains all the information you need.

Edit: As Gilles' answer to the linked question suggests, you don't need a full-blown root file system for testing, you could just use an initrd image (say, Arch Linux's initrd like here)

share|improve this answer
I have made a debian image. Now how will I choose initrd image for that? In other words, which file will I choose as initrd? – PaulDaviesC Jan 14 '13 at 17:26
@sr_ I am using ubuntu 12.04.1 how could I get qemu-img? – Coder404 Jan 20 '13 at 21:31
@sr_ is qemu-utils the modern day version of qemu-img? – Coder404 Feb 2 '13 at 0:05
qemu-img is one of the tools in qemu-utils – sr_ Feb 2 '13 at 9:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.