How to redirect the Linux guest kernel console to a serial port / file

For debugging purposes it's often useful to redirect the output of a guest Linux kernel to the host. To achieve this, set up a serial port on the VM setting of the virtual machine. Choose Raw File which will write the kernel output into a file at the host. More advanced users might select Host Pipe and connect a proper application on the host with the pipe.

Then edit the kernel parameters of the guest Linux kernel. Either do this directly from the GRUB command line or edit the appropriate GRUB config file. For the original GRUB, this is /boot/grub/menu.lst. Add the following parameters:

console=ttyS0 console=tty0 ignore_loglevel

The first parameter will ensure that all kernel output is redirected to the serial console. The second parameter will ensure that the kernel output is still logged to the guest text console. The third parameter enforces the guest Linux kernel to print all kernel messages to the console.
ContactPrivacy policyTerms of Use