1

I'm trying to install Windows 10 with virt-install on my Ubuntu Server LTS 20.04. I'm not really an expert on virtualization, but I try installing with:

$ virt-install --name=windows10 --vcpus=4 --memory=8192\
--cdrom=/mnt/data/iso/Win10_20H2_v2_EnglishInternational_x64.iso\
--disk /mnt/data/vm-images/win10-vm,size=50,format=qcow2,bus=virtio\
--network bridge=br0,model=virtio --os-type=win10 --os-variant=win10\
--graphics vnc

But get the following warning, and it hangs at the Waiting for installation to complete. (probably because I need to access Windows GUI to actually install?).

WARNING  Graphics requested but DISPLAY is not set. Not running virt-viewer.
WARNING  No console to launch for the guest, defaulting to --wait -1

Starting install...
Allocating 'win10-vm'                                        |  50 GB  00:00:06
Domain installation still in progress.
Waiting for installation to complete.

I have a VNC client on my MacBook (TigerVNC 1.11.0 on macOS Big Sur), but I can't connect. A bit of searching tells me something about virt-install not finding a display (since no display is connected to the Ubuntu machine?), and something about X-forwarding in SSH, but I couldn't find a clear guide. Guides I could find all either use GUI on Linux machine, using virt-manager, or install VMs that only need SSH access. But I did this when I was testing oVirt on CentOS (headless) so I know it should be possible, but I can't figure out how to do from CLI (via SSH).

Could anyone point me to a (thorough, since I'm quite new at this) guide for how to install a VM that needs VNC access on a headless machine that I access via SSH?

3
  • Are you sure 50g is sufficient for windows? Dec 27, 2020 at 20:52
  • Probably not, I initially used 100 GB. I just tried a smaller disk the last time I tried, since I wasn't sure if creating 100 GB would take too long (and that's why I didn't see anything happening). Probably not something to worry about, I just tried pretty much everything I could think of (which wasn't all that much, tbh).
    – Aephir
    Dec 27, 2020 at 22:23
  • I cannot check it on my computers now. I can be more helpful tomorrow. But I believe you can get vnc port number to connect through "virsh domdisplay" command. Then, with the VNC program on your workstation, you are going to have to connect to your server at the specified port.
    – NK_
    Dec 28, 2020 at 1:58

1 Answer 1

1

Please don't mind my previous comment. This one is tested. You have to give some more parameters to --graphics option when you install the VM, as below:

$ virt-install --name=windows10 --vcpus=4 --memory=8192\
  --cdrom=/mnt/data/iso/Win10_20H2_v2_EnglishInternational_x64.iso\
  --disk /mnt/data/vm-images/win10-vm,size=50,format=qcow2,bus=virtio\
  --network bridge=br0,model=virtio --os-type=win10 --os-variant=win10\
  --graphics vnc,port=5901,listen=0.0.0.0`

It specifies that server will listen to the VNC requests on all IPs, otherwise it listens to them on loopback address (127.0.0.1). After then, with the following command you will see the listening port of VNC:

virsh domdisplay windows10

It must return something like: vnc://localhost:1 Then you can connect to your server with VNC at the specified port.

2
  • Great. I replaced the colons (:) with =, and changed port 5091 to 5901, and it seems to work. Thanks!
    – Aephir
    Dec 28, 2020 at 9:08
  • Glad to help :)
    – NK_
    Dec 28, 2020 at 9:11

You must log in to answer this question.

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