KVM enable vm serial console

From Bitbull Wiki
Jump to navigation Jump to search

How to configure serial console for KVM vm. So virsh will have access:

virsh console <vm-name>

1 ubuntu

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service

2 alpine

2.1 Enabling a login console

This is done in /etc/inittab. There is commented entry for ttyS0. Just enable it.

# Put a getty on the serial port
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100

To start the getty, restart init:

kill -HUP 1

2.2 Enabling two consoles during boot

It's possible to output to both the serial and vga console during the system boot.

append "quiet console=ttyS0,9600 console=tty0"

Not known how to do the same thing in the extlinux menu. You might find a starting point in this thread: http://patchwork.openembedded.org/patch/45175/

2.3 Add your serial console to the trusted local terminal list

If you face the problem that the login prompt always refuses your password when you use serial console, you missed this entry.

Add this to the /etc/securetty file:

ttyS0