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 Red Hat

1.1 RHEL9

grubby --update-kernel=ALL --args="console=tty0 console=ttyS0,115200"

1.2 RHEL8

grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) console=tty0 console=ttyS0,115200"

2 ubuntu

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

3 alpine

3.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

3.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/

3.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: