How to enable console access on KVM guest

Feb 10, 2020


Both methods will require a reboot.

Method 1

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

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

Add the end of the kernel line console=ttyS0

# vi /boot/grub/grub.conf
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

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet console=ttyS0"
# 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.

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

Now you can connect on the console

[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: 

Vagrant CheatSheet

Monitoring disk activity with iotop

comments powered by Disqus