Skip to content
systemcoding.dev
Virtualization

Get kernel output on your terminal with console=ttyS0

Pass console=ttyS0 in -append so a Linux 6.12 guest prints boot messages to QEMU's serial port, which -nographic wires to your terminal.

1 min read
Summarize in AI

A Linux kernel booted with -kernel and -nographic looks dead if you never tell it where to print. On x86 the kernel's default console is the virtual terminal (VGA), and -nographic removes the screen, so the output goes nowhere you can see. The fix is to point the kernel at the first serial port, which QEMU's -nographic already connects to your terminal.

Shell
qemu-system-x86_64 -m 512 -nographic \
  -kernel arch/x86/boot/bzImage \
  -initrd rootfs.cpio.gz \
  -append "console=ttyS0 panic=-1"

The first line you get back from the kernel confirms the option reached it:

Text
[    0.000000] Command line: console=ttyS0 panic=-1

console=ttyS0 is parsed by the kernel at boot, as described in the kernel parameters list, and it needs CONFIG_SERIAL_8250_CONSOLE=y built in to Linux 6.12, not as a module. A kernel without it boots silently, and the symptom is identical to a hang.

On other machine types the serial device has another name. The Arm virt board uses a PL011, so the argument becomes console=ttyAMA0, and RISC-V virt uses a 16550 that appears as ttyS0 again. Repeating console= more than once sends output to several consoles, and the last one listed becomes /dev/console for the init process.

Also inDebugging
Taggedlinuxqemu
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.