This brief guide explains what is SPICE and its use cases, how to enable SPICE support for a Proxmox VM, and how to access the Proxmox virtual machines with SPICE client.
By default, Proxmox uses noVNC client to access the console of a Virtual machine. The noVNC client is just enough if you want to connect to a Proxmox VM without any additional tools. However, a few things don't seem to work well with noVNC.
One of the major problem is I can't hear any sound from the VM. Also, when I play a YouTube video, it is lagging and stuttering and out of sync with the audio.
After searching through Proxmox forums, many users have suggested that SPICE client helped them to solved such issues. So I gave it a try. To my surprise, SPICE works great.
I can now hear the sound from the Proxmox virtual machine and also Video lagging issue is greatly decreased (not completely though).
What is SPICE?
SPICE, short for Simple Protocol for Independent Computing Environments, is an opensource remote desktop application to access virtual machines.
When you access the VMs via the SPICE client, you will feel like you're interacting with a local machine. You can play audio, video, share folders and share USB in the Proxmox VMs, without any difficulties.
The integrating of Spice into Proxmox VE provides a seamless solution for interaction with virtualized desktop devices, like keyboard, mouse, audio and video. Sound and USB passthrough works out of the box with SPICE!
Interaction between front-end and back-end is done using Virtual Device Interfaces (VDI).
Spice was first introduced with Proxmox VE 3.1. It is suitable for both LAN and WAN usage, without compromising on the user experience.
Using Spice on Proxmox VE is easy and secure. All traffic between VMs and the Proxmox host is fully encrypted.
SPICE client is available for Android, Linux, Mac OS, and Windows operating systems.
Enable SPICE Support for Proxmox Virtual Machines
To use SPICE support, you need a SPICE client (E.g. Virt-viewer) and SPICE drivers (VirtIO, QXL Graphic card drivers) inside the virtual machine.
All Linux distributions that are released after 2011 includes the SPICE drivers as part of the Xorg package. So there is no need to install them if you use a modern Linux VM.
To install Virt-viewer in Proxmox VE/Debian host system, simply run:
$ sudo apt install virt-viewer
Now open the Proxmox VE Web UI by navigating to https://IP-ADDRESS:8006 from your browser window. Enter the username and password to log in to Proxmox Web UI.
Click on the Virtual machine and go to "Hardware" section and double click "Display" option. Set Graphic card value as SPICE as shown in the screenshot below. You can also increase the memory value if you want to use SPICE with high resolutions. 32 MB is more than enough for 4K resolutions. Click OK to save the changes.
You will now notice that the values for "Display" parameter setting have been set to SPICE with 32MB memory in the Web UI.
Add Audio Devices
You can add the audio devices from the Hardware section of a VM.
Go to Virtual machine -> Hardware. Click "Add" and choose "Audio device" from the sub menu.
Choose the Audio device type.
Currently, there are three audio devices supported:
- ich9-intel-hda: emulates Intel HDA Audio on ICH9 chipsets
- intel-hda: emulates Intel HDA Audio on ICH6 chipsets. Use if the ICH9 one does not work properly
- AC97: useful for older OS`s like Windows XP
After choosing the Audio device from the list, click Add.
Add USB Devices
To add an USB device, go to "Hardware" section of the VM. Click "Add" and select "USB Device" from the sub menu. Choose "Spice Port" as USB device type and click Add.
Similarly, you cad add other hardware devices, for Network card, PCI device etc.
Access Proxmox Virtual Machine with SPICE
Now click the "Start" button on the top right corner to start the VM.
Once the VM is started, click "Console" drop-down box on the top bar and choose SPICE from the list.
This will trigger the download of the connection config file. Open this file with Remote Viewer to start the session. Make sure you have installed "Virt-viewer" package.
Now the Proxmox VM will run in the SPICE client i.e Remote Viewer (Virt-viewer).
You may now notice that the resolution and sound will be working. You can also use the USB devices under VM.
SPICE also offer two enhancements to improve the remote viewer experience.
- Foldersharing - Share a local folder with Proxmox VMs
- Videostreaming - Encode fast refreshing areas in a lossy video stream.
To share a folder, you should install "spice-webdavd" daemon inside the Proxmox VM. Also make sure the spice-vdagent service is installed and running in the VM in order to fix display resolution issues.