How to enable console access on KVM guest

RHEL 6

Both methods will require a reboot.

Method 1

This will add console=ttyS0 for every kernel into /boot/grub2/grub.cfg file

1
# grubby --update-kernel=ALL --args="console=ttyS0"
Method 2

Add the end of the kernel line console=ttyS0

1
# vi /boot/grub/grub.conf
1
kernel /vmlinuz-2.6.32-754.el6.x86_64... KEYTABLE=us rd_NO_DM rhgb quiet console=ttyS0

RHEL 7-8

Method 1

You may use same method as for RHEL 6.

Method 2

You can also edit /etc/default/grub file and add console=ttyS0 to the end of GRUB_CMDLINE_LINUX line

1
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet console=ttyS0"
1
# grub2-mkconfig -o /boot/grub2/grub.cfg
Method 3

Only the first two methods will require a reboot, for this method the reboot is not required.

1
2
# systemctl enable serial-getty@ttyS0.service
# systemctl start serial-getty@ttyS0.service

Now you can connect on the console

1
2
3
4
5
6
7
8
[root@localhost ~]# virsh console vm01
Connected to domain vm01
Escape character is ^]

CentOS Linux 7 (Core)
Kernel 3.10.0-1062.el7.x86_64 on an x86_64

localhost login: