Saturday, December 18, 2010

get serial port output from qemu

So I was testing systemd in qemu, and wanted to see its debug output. Here is how I managed to do it.

1. Start qemu with the serial port redirected somewhere. I chose to redirect to a file since that would be searchable.

qemu-kvm FL-devel-dev.img -serial file:/tmp/systemd-console

-serial will redirect the serial port output to the file.

(The other options I use are "-vga vmware -m 512M -redir tcp:5555::22", but it's irrelevant here.)

2. Tell the kernel that the console is on the serial port.

Edit the bootloader config and add console=ttyS0 to the kernel arguments.

You may also need to remove "splashy", "quiet" or others.

Now you can inspect the log file on the host.