I installed KVM on Ubuntu server as described here. However, I am unable to get out of a ‘virsh console domain’ command. How can I exit from a “virsh console” connection over ssh based session? How do I exit a “virsh console” connection command on Linux KVM session?
You can use ‘virsh console vm’ command to connect the virtual serial console for the guest machine. The syntax is: virsh console domain virsh console vmNameHere virsh console --domain vmNameHere --safe
To exit a virsh console from a shell prompt on Linux:
Open a shell prompt or login using ssh.
Login to a host server called server1.
Use the virsh console command to log in to a running VM called ‘centos7’ type: virsh console centos7
To exit a virsh console session, type CTRL+Shift followed by ].
How to exit a “virsh console”?
The keyboard shortcuts are as follows if you are using English keyboard i.e. Escape character is ^]:
More on virsh-console options
Type the following command: $ virsh help console Sample outputs:
console - connect to the guest console
console <domain> [--devname <string>] [--force] [--safe]
Connect the virtual serial console for the guest
[--domain] <string> domain name, id or uuid
--devname <string> character device name
--force force console connection (disconnect already connected sessions)
--safe only connect if safe console handling is supported
console – connect to the guest console SYNOPSIS
console <domain> [–devname <string>] [–force] [–safe] DESCRIPTION
Connect the virtual serial console for the guest OPTIONS
[–domain] <string> domain name, id or uuid
–devname <string> character device name
–force force console connection (disconnect already connected sessions)
–safe only connect if safe console handling is supported
Other recommended keyboard shortcuts for kvm exit from a virsh console command on Linux are as follows:
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.