Monday, April 10, 2017

Unable to access virsh console of a KVM VM.

Often when I download qcow2 images from internet and access them using virsh console , I can't see the console.
Here's what we need to do:

Note: /vms/images/ubuntu_1404_v05.qcow2 is the qcow2 image for which we're unable to access the console.

sudo apt-get install qemu-utils
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 /vms/images/ubuntu_1404_v05.qcow2
sudo fdisk /dev/nbd0 -l
sudo mount /dev/nbd0p1 /mnt

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

chroot /mnt

vi /etc/default/grub and modify the parameters
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
GRUB_CMDLINE_LINUX="console=ttyS0"

update-grub


sudo umount /mnt

sudo qemu-nbd --disconnect /dev/nbd0

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home