Accessing Console Of Ubuntu 16.04 KVM Guest

Thanks @Programster solution works for me. Since I do not even have SSH access, I have to install and use virt-edit.

sudo apt install libguestfs-tools
sudo virt-edit -d myVM /boot/grub/grub.cfg

Replace all instances of quiet with quiet console=ttyS0 in the grub.cfg file and start my VM for console connect.

virsh start myVM && virsh console myVM

Do not forget to edit and update grub per @programster answer after login.


Update 13th March 2017

For those already in the situation described above, you can fix your existing guest using the original answer below. However, for those of you who would rather never have to go through this pain again, you can just add the following so the %post section of your kickstart file:

%post --nochroot
(
    sed -i "s;quiet;quiet console=ttyS0;" /target/etc/default/grub
    sed -i "s;quiet;quiet console=ttyS0;g" /target/boot/grub/grub.cfg
) 1> /target/root/post_install.log 2>&1
%end

This will ensure that the necessary changes to grub are made as described below, so that new guests you deploy through using the kickstart file won't suffer from this problem.

Original Answer

For those who manage to connect via SSH after finding out the IP using arp -an on the host, you can perform the following steps (taken from the bottom of this page) once you are connected to the guest.

Edit the grub configuration file:

sudo vim /etc/default/grub

Add the text console=ttyS0 to the GRUB_CMDLINE_LINUX_DEFAULT parameter as shown below:

enter image description here

Then have the grub menu be rebuilt using your change by executing:

sudo update-grub

Now you should be able to connect to a working console with virsh console [guest ID].

This will keep working as future kernels are added to the system, but I would much rather have a solution that didn't require me to have SSH access to the guest in the first place.

Tags:

Console

Tty

Kvm