Enable remote VNC for kvm+qemu
Do not do it in /etc/libvirt/qemu.conf
, but rather do it in the definition file for the guest itself, for example in /etc/libvirt/qemu/serv64_dev.xml
. here is an example of the relevant section:
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='vmvga' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
Use virsh edit domain name
to edit, example virsh edit serv64_dev
(from any directory), as it does some additional checks upon exit.
The default editor used by virsh edit
is as defined by the $EDITOR environment variable, or VI if it does not exist. add export EDITOR="/bin/nano"
to your ~/.bashrc
file to set, for example, nano as your default editor.
Related videos on Youtube
pgb
Updated on September 18, 2022Comments
-
pgb over 1 year
I'm using
kvm+qemu
on Ubuntu 14.04 Server.I need to enable VNC for remote hosts, so I edited
/etc/libvirt/qemu.conf
and uncommentedvnc_listen = "0.0.0.0"
there.My problem, is that I don't know how to reload this configuration file without restarting all the hosts. Already tried:
service libvirt-bin reload
reload libvirt-bin
andkillall -HUP libvirtd
without success. Is there a way to reload this configuration file? Or do I need to restart all the guests? -
pgb over 8 yearsDone, but still I can't connect (nor telnet to port 5904, which is the one assigned to that VM)
-
Doug Smythies over 8 yearsI would have expected it to be on port 5900, unless there are already 4 others that started before it.
-
pgb over 8 yearsIt's the fourth VM,
virsh vncdisplay MyVM
reports:4
. In any case, all ports from 5900 to 5904 are unaccessible through telnet... -
Doug Smythies over 8 yearsAnd you are attempting to connect to the host IP address port 5904, right? Then, I am out of ideas, as I have only ever made my VM's with VNC support to start with. If you think it will help, I can post my entire .xml file.
-
pgb over 8 yearsYes, host IP address. Don't worry posting the entire xml, I'll try changing
qemu.conf
and see if that helps. -
Doug Smythies over 8 yearsO.K., Please post back how you make out. By the way, I have never edited
qemu.conf
-
Doug Smythies over 8 yearsDo you have a firewall (iptables or ufw or ?) blocking access to those ports?