How to enable KVM virsh console access for Ubuntu Linux VM

To enable console access for a KVM virtual machine (VM) managed by virsh on Ubuntu Linux, you need to perform the following steps:

  1. Connect to the virtual machine using virsh:
virsh -c qemu:///system console <VM_name>
  1. Log into the virtual machine as the root user.
  2. Install the getty package, if it is not already installed:
apt-get install agetty
  1. Open the /etc/default/grub file and add the following line:
GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"
  1. Update the grub configuration:
update-grub
  1. Restart the virtual machine:
reboot
  1. After the virtual machine has restarted, connect to the virtual machine console again:
virsh -c qemu:///system console <VM_name>

You should now have console access to the virtual machine through the virsh command. Note that the <VM_name> should be replaced with the actual name of your virtual machine.

Leave a Comment