Table of Contents

QEMU Serial Console

Serial console redirection is the most common way to interact with QEMU VMs running headless. -nographic redirects the emulated serial port to your terminal's stdin/stdout.

qemu-system-arm -M versatilepb -kernel zImage -nographic
# Kernel output appears on terminal; you can type at the login prompt

The kernel must be told which port to use for console output via the -append argument:

qemu-system-arm -M versatilepb -kernel zImage \
  -append "console=ttyAMA0" -nographic

ttyAMA0 is the serial port name for ARM Versatile. Other architectures use ttyS0 (x86), ttyUART0 (RISC-V). The kernel's boot output and login prompt appear on your terminal.

Exit QEMU with Ctrl+A X (press Ctrl+A, release, then X). Some systems use Ctrl+D or Ctrl+C (though Ctrl+C may only send SIGINT to the guest).

Multiple serial ports:

qemu-system-x86_64 -serial stdio -serial file:serial1.log
# First port (-serial stdio) goes to terminal
# Second port goes to file serial1.log

This allows the guest to use one port for console and others for logging or inter-VM communication.

Without -nographic, QEMU opens a graphical window. The serial port is still available—typically accessed via a menu in the QEMU GUI. -nographic is almost always preferable for headless embedded testing.

Monitor console (-monitor stdio) opens QEMU's internal monitor on stdin instead of the guest serial port. You can inspect VM state, change hardware configuration at runtime, etc. Rarely used but useful for advanced debugging.

Serial redirection to /dev/null (-serial null) discards output—useful for benchmarking when output speed doesn't matter.