2

I've created a virtual machine using virt-install with graphics --none. I want to enable vnc. I've tried

virsh -c qemu:///system qemu-monitor-command vm171-SC-1 --hmp change vnc :3

but it doesn't work

virsh -c qemu:///system qemu-monitor-command vm171-SC-1 --hmp info vnc
Server: disabled

How can I enable vnc after running virt-install? I don't want to install with vnc enabled (i.e --graphics vnc,listen=0.0.0.0,port=) is not an option because I want it to send its output to the same termnial that I am in.

1 Answer 1

6

Edit the VM config with virsh edit and add the relevant bit of XML within <devices>?

<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>

It should also be possible to replicate this using virt-xml, something like this:

virt-xml --build-xml --graphics vnc,port=-1,autoport=yes,listen=0.0.0.0

or

virt-xml <yourVMname> --add-device --graphics vnc,port=-1,autoport=yes,listen=0.0.0.0

However, it looks like it doesn't support the autoport keyword as of version 1.3.2 (Ubuntu 16.04 LTS), so it looks like this part would have to be added separately.

3
  • can it be done without changing the xml? I want to be able to script it.
    – sashang
    Jun 24, 2015 at 10:05
  • 1
    Looks like a new tool is required: blog.wikichoon.com/2014/03/… Jun 24, 2015 at 18:48
  • Looks like autoport doesn't work anymore. Got lucky with virt-xml pw01p.npf.local --add-device --graphics vnc,port=-1,listen=127.0.0.1,keymap=fr. Notice that I also specified keymap for VNC. Jan 5 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .