Monday, April 11, 2022

[SOLVED] Default Port for Spice in QEMU

Issue

I'm virtualizating Ubuntu and other aarch64 Operating Systems on my KVM-enabled Raspberry Pi 4 (running Ubuntu Desktop 21.04). I've successfully enabled OpenGL acceleration in my aarch64 Ubuntu 20.04 guest, using the QEMU arguments --virtio-gpu,virgl=on --display sdl,gl=on. However instead of using SDL to render the window, I want to use Spice. The following would do this:

qemu-system-aarch64 --M virt --enable-kvm --cpu host --m 2G \
--bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
--device usb-ehci --device usb-kbd \
--spice disable-ticketing,gl=on,addr=127.0.0.1,port=3001 \
--device virtio-gpu,virgl=on

(here's an example you can reproduce with an x64 system)

qemu-system-x86_64 --M pc-q35 --enable-kvm --cpu host --m 2G \
--device usb-ehci --device usb-kbd \
--spice disable-ticketing,gl=on,addr=127.0.0.1,port=3001 \
--device virtio-gpu,virgl=on

but returns SPICE GL support is local-only for now and incompatible with -spice port/tls-port.

When I omit the port=3001 in the --spice argument, it does not throw the error, however I do not know how to connect to this new VM. Using --display spice-app does not work because Ubuntu's virt-viewer version is 7.0, instead of the necessary 8.0. Therefore, I tried using remote-viewer (bundled with virt-manager) and I couldn't connect to 127.0.0.1 or localhost, even if I tried using ports like 3000, 3001, 5900, 5901.

So, what port do I need to (locally) connect to my VM through remote-viewer? My VM is running on my Raspberry Pi 4, and I want to connect to it through that same Pi 4.


Solution

The option "gl=on" and "port=..." are incompatible, this was introduce in this commit
The comment explains virtlg use a unix socket and thus is not compatible with remote access.

However you can connect locally, starting qemu with :

 --spice disable-ticketing,gl=on,unix,addr=/tmp/spice.sock 

And then connect locally using :

remote-viewer spice+unix:///tmp/spice.sock


Answered By - mpromonet
Answer Checked By - Gilberto Lyons (WPSolving Admin)