I have been trying to setup QEMU to provide console output only. So far I have succeeded with the following parameters: qemu-system -curses -hda debian.img, where debian.img is a working Debian installation. No other boot related parameters are used. (N)Curses seems to be terribly buggy and slow for this purpose however, at least under a macOS host.

I found out that a better way to achieve console, non-gui output to the terminal that qemu is launched in by using -serial stdio -append "console=ttyAMA0" instead of -curses. This option requires you to specify a kernel with the -kernel parameter however. Is there a way I can extract a bootable kernel from my existing Debian installation that I can provide to qemu? I already tried copying vmlinux from /boot, and also followed this guide to extract the kernel from the OS, but they won't boot under QEMU with my existing debian.img file. I believe I possibly have to supply the initrd.img from my OS to qemu as well.

Now, is it possible to keep using my exisiting debian.img file with a fully working OS on it, while also passing an (extracted) kernel from that image (or elsewhere if needed) to qemu using the -kernel parameter? (and the same question for the initrd.img file) My guest OS on the debian.img file is Debian Jessy.

1 Answer 1


If you use direct kernel booting (via the -kernel QEMU option), you almost certainly want to provide the -initrd as well. They can be copied from the /boot directory of the running emulated system, or you can use losetup and kpartx to make the partitions of the image file mountable (and make sure to umount them before you start the emulated system again). Generally you'll also have to -append "root=/dev/sda2 console=ttyAMA0" or similar.

An alternative way is to append the necessary kernel parameter to the boot loader configuration in the image. It's less flexible, but maybe you don't actually need all the flexibility of -append. You may need to run update-grub or something similar to get your console parameter embedded into the actual boot menu. Run cat /proc/cmdline in the booted system to check if it's really in effect.

You'll need -serial stdio in either case, but replace it by -nographic once you don't need the graphical window anymore.

  • My question mostly concerns exactly how the initial ram disk and the kernel should be exported, as I was not able to find a good way to do this. From your answer I understand that they can be exported from the running system, is this done by just copying them from /boot? (i.e. copying /boot/vmlinuz and /boot/initrd.img to my host) I will look into the second method now as well.
    – rien333
    Jul 10, 2017 at 15:17
  • if I just copy them from /boot the qemu app window comes with "Booting from rom..." and then "Booting from EDD... ok" and then freezes. The terminal I launch qemu in shows nothing.
    – rien333
    Jul 10, 2017 at 15:25
  • As for the alternative, I'm not entirely sure what you mean by the "necessary kernel parameter", but appending the rule "console=ttyAMA0" to both /boot/cmdline.txt and /etc/grub/defaults and removing the -append parameter from the qemu invocation leads to the qemu GUI starting without any output to the terminal (or input for that matter). (invocation: qemu-system-x86_64 -hda debian.img)
    – rien333
    Jul 10, 2017 at 23:50
  • You still need to provide a serial port via -serial stdio. Please always show the full command line you're experimenting with. Jul 11, 2017 at 16:10
  • 1
    Can you share your image file? Being able to influence your kernel command line is critical. Also, ttyAMA0 is an ARM AMBA serial device, so qemu-system-x86_64 probably won't emulate it. Try console=ttyS0 instead. Also note that unless your serial driver is compiled in, you won't see early kernel messages (those before the module is loaded) on the serial console. Jul 17, 2017 at 7:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .