How To Enable Virsh Console Access For KVM Guests

This articles describes how to enable virsh console on KVM Guests

List Virtual Machines

$ sudo virsh list --all
 Id   Name               State
-----------------------------------
 13   debian10-server3   running

After installing KVM and trying to console, all I see is below and no access to machine:

$ sudo virsh console debian10-server3
Connected to domain centos8
Escape character is ^]

Type the following to exit:

$ Ctrl+]

Enable Virsh Console Access For KVM Guests

Log in via ssh or kvm virtual machine manager to the KVM guest system (virtual machine), not in the KVM host.

Run the following:

$ sudo systemctl enable serial-getty@ttyS0.service
Created symlink /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service → /lib/systemd/system/serial-getty@.service.

 

$ sudo systemctl start serial-getty@ttyS0.service

verify it by looking into the VM’s configuration XML file from the Host:

$ sudo virsh edit debian10-server3

Scroll to see the following lines…

Now start the virsh console of the guest system from the host using command:

$ sudo virsh console debian10-server3
Connected to domain centos8
Escape character is ^]

Press ENTER again and type your user name and password to connect to the guest machine. To exit, type Ctrl+]

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.