[libvirt] How to connect to the running VM

Zdenek Styblik stybla at turnovfree.net
Fri Jul 29 14:06:37 UTC 2011

On 07/29/11 13:36, bala suru wrote:
> Hi,
> I have deployed some VM on to the KVM-qemu and installed libvirtd ..
> I could see the VM running by command virsh list .
> but how to login to the VMs other than SSH ..? i tried virsh vncdisplay ,
> but no output ..
> regards
> bala
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


if VM is running at localhost eg. your workstation, I do:

% netstat -nlp;

look for '' as libvirt assigns VNC ports automatically and
in incremental order. (Note: this, however, is not a rule. And you can
assign whatever port you want by hand.)

~~~ SNIP ~~~
tcp        0      0 localhost:5901          *:*
LISTEN      -
~~~ SNIP ~~~

Then I just use VNC client like % vncviewer localhost:5901; to connect
to VM.

Have you tried to hit a key or move the mouse? Console/screen might be
in suspend mode in order to "save" power.

Also, there might be few catches which depend on your setup.
1] are you sure VM has VNC console assigned? Use % virsh; and 'dumpxml
<domain>' command to check out.

~~~ SNIP ~~~
<graphics type='vnc' port='5901' autoport='yes'/>
~~~ SNIP ~~~

2] it might be password protected, TLS might be required etc. etc.

If it's at remote host, I recommend to use SSH to tunnel VNC port. You
can find how-to at internet.
You can also use 'virt-manager' which is included as package in many
distributions. Well, at least in Fedora, Debian and, I believe, Ubuntu.

I hope lines above help you a bit.


Zdenek Styblik
email: stybla at turnovfree.net
jabber: stybla at jabber.turnovfree.net

More information about the libvir-list mailing list