Fixing KVM guest virsh console hangs at Escape character

virsh is a tool to manage virsh guest domains and the command “virsh console [domain id/name]” can be use to connect the virtual serial console for the guest. But sometimes the connection with the serial consoleĀ  hangs or stucked at the “escape character ^] ” and not bringing you to the guest login after pressing “Enter” , it looks something like this:

tux@ubuntuserver1:~$ virsh console 11
Connected to domain eve-ng
Escape character is ^]

In order to exit, need to use Escape character depending on type of keyboard. Typically, for English keybord “Ctrl+]” will work.

Here are few stepsĀ  you can try to fix this:

1. Edit/update the /etc/default/grub configuration (some distribution maybe different). Tested working in Ubuntu.

From:
GRUB_TERMINAL=console
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash vga=788″

To:

GRUB_CMDLINE_LINUX_DEFAULT=”console=tty0 console=ttyS0″
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND=”serial –unit=0 –speed=115200 –word=8 –parity=no –stop=1″

2. Update the config and reboot

#update-grub

Sample output:

root@eve-ng:~# update-grub
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.9.40-eve-ng-ukms-2+
Found initrd image: /boot/initrd.img-4.9.40-eve-ng-ukms-2+
Found linux image: /boot/vmlinuz-4.4.0-179-generic
Found linux image: /boot/vmlinuz-4.4.0-178-generic
done

3.Ā  Ā  Enable and start serial getty

# systemctl enable serial-getty@ttyS0.service
# systemctl start serial-getty@ttyS0.service

4. Reboot

#reboot

Verify:

tux@ubuntuserver1:~$ virsh list
Id Name State
—————————————————-
4 eve-ng running

tux@labucs1:~$ virsh console 4
Connected to domain eve-ng
Escape character is ^]

Eve-NG (default root password is ‘eve’)
Use http://192.168.10.21/

eve-ng login:

About the author

Free Linux

View all posts

2 Comments

  • Looks good, if you have other access options to the guest e.g. ssh. If not, one can sit and cry

Leave a Reply