Saturday, June 30, 2012
I faced several issue when I tried to use "virsh console
" in KVM. It simply hangs in following line:
"Escape character is ^]"
After trying several things here is how I solved the problem:
Step 1: If the VM is running destroy it (virsh destroy )
Step 2: Mount the image (following instructions are for raw disk image for Ubuntu host)
kpartx -av /location-to-disk-image
mount /dev/mapper/loop0p2 /path-to-mount
[Note: kpartx list out several mappers and you need to pick the correct one, just play around it you will find the correct one to map. Correct one is one with grub directories]
vi /path-to-mount/grub2/grub.cfg (in your case it might be grub)
add "console=ttyS0" as shown below:
kernel /vmlinuz ro a-set-of-values console=ttyS0
kpartx -dv /location-to-disk-image
Step 3: Now start the VM "virsh start "
Step 4: Console to the VM "virsh console "