SPICE Support + Config


Recommended Posts

Hi All,

 

I haven't see any posts in regards to using SPICE in 6.2.0-rc, but thought I'd share my experience for others looking to use SPICE (which, by the way, is incredibly slick).

 

Unfortunately, it seems like SPICE support isn't included in the WebGUI yet, so it does require a bit of manual intervention with the XML file.

 

NOTE: This example does NOT implement any security features whatsoever. If you don't want your VMs to be open to everyone, read up a little about implementing TLS or SSL.

 

Step 1: Create your VM as you normally would, have it set for VNC.

 

Step 2: Add the SPICE <graphics> section (overwrite any existing <graphics> section)

 

<graphics type='spice' port='20001' autoport='no' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
</graphics>

 

Step 3: Add the SPICE Audio section (slot 0x06 is an unused address in my config, adjust as necessary so it isn't a duplicate). SPICE will pass audio from VM to guest.

 

<sound model='ac97'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</sound>

 

Step 4: Add the QXL video section if it doesn't already exist

 

<video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>

 

And voila! You should be able to use something like virt-viewer on a Windows PC to access your VM GUI along with passthrough audio. This is very basic configuration, there are tons of other options that may or may not work yet such as guest additions (copy/paste, folder sharing, USB redirection, etc).

 

Obviously this is a sort of workaround until the unRAID team officially slots in SPICE support - though including SPICE in the builds is a step in the right direction (I'm not a VNC fan).

 

Link to comment
  • 2 years later...

So I installed virt-viewer on my Windows desktop and edited my VM's XML configuration file overwriting the VNC graphics with spice:

<graphics type='spice' port='3001' autoport='no'>
   <listen type='address'/>
</graphics>

I also installed spice-vdagent on the VM, not sure if it was a necessary step or not but I did anyway:

[vm-manjaro ~]# systemctl status spice-vdagentd
 spice-vdagentd.service - Agent daemon for Spice guests
   Loaded: loaded (/usr/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: disabled)
   Active: active (running) since Sat 2018-12-01 17:24:12 EST; 3s ago
  Process: 1619 ExecStart=/usr/bin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 1620 (spice-vdagentd)
    Tasks: 1 (limit: 2372)
   Memory: 360.0K
   CGroup: /system.slice/spice-vdagentd.service
           └─1620 /usr/bin/spice-vdagentd

Dec 01 17:24:12 vm-manjaro systemd[1]: Starting Agent daemon for Spice guests...
Dec 01 17:24:12 vm-manjaro systemd[1]: Started Agent daemon for Spice guests.

Finally, I made sure iptables was disabled. Trying to connect from my Windows desktop, I get the following:

C:\Program Files\VirtViewer v6.0-256\bin>remote-viewer.exe spice://192.168.1.246:3001/ --debug

C:\Program Files\VirtViewer v6.0-256\bin>
(remote-viewer.exe:17924): Gtk-WARNING **: Could not find signal handler 'virt_viewer_window_menu_change_cd_activate'.  Did you compile with -rdynamic?
(remote-viewer.exe:17924): virt-viewer-DEBUG: Opening display to spice://192.168.1.246:3001/
(remote-viewer.exe:17924): virt-viewer-DEBUG: Guest (NULL) has a spice display
(remote-viewer.exe:17924): virt-viewer-DEBUG: After open connection callback fd=-1
(remote-viewer.exe:17924): virt-viewer-DEBUG: Opening connection to display at spice://192.168.1.246:3001/
(remote-viewer.exe:17924): virt-viewer-DEBUG: New spice channel 000000000443F830 SpiceMainChannel 0
(remote-viewer.exe:17924): virt-viewer-DEBUG: notebook show status 000000000433FE60
(remote-viewer.exe:17924): virt-viewer-DEBUG: main channel: failed to connect Could not connect to 192.168.1.246: No connection could be made because the target machine actively refused it.
(remote-viewer.exe:17924): virt-viewer-DEBUG: Destroy SPICE channel SpiceMainChannel 0
(remote-viewer.exe:17924): virt-viewer-DEBUG: zap main channel

Same with the GUI, it says the target machine actively refuses the connection. I get the same error if I try a different port.

 

What am I doing wrong?

Link to comment
  • 8 months later...

resurrecting this old thread just to say you can install virt-manager fairly easily on windows thanks to Windows Subsystem Linux (WSL).  You'll merely need to enable WSL then install your favorite distro in WSL, then install virt-manager on that distro.  Finally you'll need to install an X window manager like Xming on your windows machine.

 

Annotation 2019-08-16 224756.jpg

Edited by flinte
Link to comment
  • 2 years later...
  • 10 months later...
On 1/13/2022 at 10:46 AM, Econaut said:

Would be great if UNRAID would include SPICE support natively for VMs. The VNC remote viewer is super buggy and copy-paste doesn't even really work.

So it looks like it Spice IS an option now. I can't seem to get copy paste working with a Windows 11 VM. Are there add-ons that need to be installed for Unraid as you would on the client itself?  (See Windows installers here--> https://www.spice-space.org/download.html)

Link to comment

@dja lets revert back here.

 

Also, off topic but related, have you figured out how to save the remote viewer recent connections? That seems to be broken. I saw some off site posts that seem to indicate it may be a known issue. 

I know you can call the .exe from CLI and pass the URL to start, but that's a bit clunky when the app has a recent list available.  (maybe)

 

Not tried to save connections will have a look.

 

I have 2 Virt serials because I have two channels defined one for QEMU guest agent and one for the Spice VDAgent

 

 

Link to comment
40 minutes ago, SimonF said:

@dja lets revert back here.

 

Also, off topic but related, have you figured out how to save the remote viewer recent connections? That seems to be broken. I saw some off site posts that seem to indicate it may be a known issue. 

I know you can call the .exe from CLI and pass the URL to start, but that's a bit clunky when the app has a recent list available.  (maybe)

 

Not tried to save connections will have a look.

 

I have 2 Virt serials because I have two channels defined one for QEMU guest agent and one for the Spice VDAgent

 

 

 

Sounds good.  Thanks for working with me on this. I would normally just use RDP, but I am using work VPNs that disable split-tunnel and require this type of remote access. I've been having to use HyperV on my local workstation, but my sever is much better equipped hardware wise. I've been hoping for a good solution that has decent integration and copy/paste....Spice def. seems to be the way to go.  Is the integration for copy/paste text only?

Link to comment
6 hours ago, SimonF said:

bug has been around for 5 years

 

https://bugzilla.redhat.com/show_bug.cgi?id=1481957

Yeah I saw that..5 years!!?? A bit surprising it has persisted that long.  It's pretty clumsy having to type that out every time. I guess I could make a batch file, but I couldn't get that to start right. , example

C:\Program Files\VirtViewer v11.0-256\bin>start remote-viewer.exe spice://192.168.1.10:5901

 App starts, but holds open the window with status updates.  I guess it doesn't matter until I can get the clipboard to work, but something to look at if anyone cares. It is definitely better than VNC from my experience.  Is there another viewer option for Spice?

 

Edit- its working now! Yea!!!!!

 

image.thumb.png.6a8ff7b60a56118d692ca7a1637be284.png

Edited by dja
Link to comment

Is it possible to get 4k resolution using Spice? (3840x2160)

 

Edit- yes!!

Edit the XML of your VM and change the video section for your virtual display device. Change vgamem from 16384 to:


vgamem='65536'

Example:

    <video>
      <model type='qxl' ram='131072' vram='65536' vgamem='65536' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

 

image.thumb.png.5acf5ac9cc5a31dd68724f84b3916b93.png

Edited by dja
  • Like 1
Link to comment
On 12/8/2022 at 6:32 PM, dja said:

Is it possible to get 4k resolution using Spice? (3840x2160)

 

Edit- yes!!

Edit the XML of your VM and change the video section for your virtual display device. Change vgamem from 16384 to:


vgamem='65536'

Example:

    <video>
      <model type='qxl' ram='131072' vram='65536' vgamem='65536' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

 

image.thumb.png.5acf5ac9cc5a31dd68724f84b3916b93.png

Thanks for the info, will look to see if we can set to 65536 as a default.

  • Like 1
Link to comment
  • 1 month later...
4 hours ago, dja said:

@SimonF could you post a Windows VM XML to look at? (W11 if you have it..)

 

I had to create a new VM and while I can copy paste and type- the stupid mouse doesn't work! Uuuggh.

You need this

 

    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
    </channel>

 

Do you have a physical secondary GPU attached? I have found mosue can disappear with physical GPU as 2nd.

 

Dont forget you need t install vdagent also.

Link to comment
17 hours ago, SimonF said:

You need this

 

    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
    </channel>

 

Do you have a physical secondary GPU attached? I have found mosue can disappear with physical GPU as 2nd.

 

Dont forget you need t install vdagent also.

I do. I guess I can remove that and try.

Link to comment
  • 2 weeks later...
On 2/2/2023 at 9:01 PM, dja said:

Is there anything else I can try? I have a Win10 machine working with copy paste, but no mouse.  My VM XML is below. No video card passed in.

 

https://pastebin.com/raw/GGuMMbfE

Ok I think I have found the way to get the mouse to work. I had to change the following in XML, not sure why client mode doesn't work. Downside is that you may need to do SHIFT-F12 to release the mouse from the client.

 

    <graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-gb'>
      <listen type='address' address='0.0.0.0'/>
      <mouse mode='server'/>
    </graphics>

Edited by SimonF
  • Like 1
Link to comment
17 hours ago, SimonF said:

Ok I think I have found the way to get the mouse to work. I had to change the following in XML, not sure why client mode doesn't work. Downside is that you need to do SHIFT-F12 to release the mouse from the client.

 

    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0' keymap='en-gb'>
      <listen type='address' address='0.0.0.0'/>
      <mouse mode='server'/>
      <clipboard copypaste='yes'/>
    </graphics>

Awesome, that did the trick, thanks!!!

 

One weird issue with Win11 persists, (not related)

The Spice service(s) don't start even when set to auto. Any ideas on how to do this? Win10 seems fine and Win11 works once you start them. (copy paste) Strange...

(I manually started below) Is there something you can make them dependent on to ensure they run? Maybe I could set another account to run them.

image.png.7198a352cbd4386833e69aed62f0376f.png

 

Link to comment
2 hours ago, dja said:

Awesome, that did the trick, thanks!!!

 

One weird issue with Win11 persists, (not related)

The Spice service(s) don't start even when set to auto. Any ideas on how to do this? Win10 seems fine and Win11 works once you start them. (copy paste) Strange...

(I manually started below) Is there something you can make them dependent on to ensure they run? Maybe I could set another account to run them.

image.png.7198a352cbd4386833e69aed62f0376f.png

 

Will check my Win11 as I dont have to start services.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.