From CSLabsWiki
Jump to: navigation, search



SPICE is a protocol that allows for high-quality virtual machine access using VDI over a network. It could be used as a communication layer between thin clients and their associated virtualized operating systems, or it could be used as it is in the COSI lab for normal machines to have quick access to a variety of different operating systems, or in any other configuration where it is better for a virtual machine to be running remotely.

SPICE on Ubuntu (and Debian)

Modern builds of QEMU (since 1.14) generally have SPICE support built in. Just install a modern version of QEMU from the repos and start it with the argument -spice and any of the arguments discussed later on the page. I've left the instructions up, but there's no need to compile QEMU with SPICE support any more.

Arch still doesn't package SPICE supports with QEMU, though: https://bugs.archlinux.org/task/23453

As SPICE is under development by Red Hat, binary packages are rpm-based. However, it is possible to run both the SPICE server and client on 64-bit Ubuntu machines, if they are compiled from source. There are several dependencies that must be installed before SPICE can be compiled; dependencies not already available in the standard Ubuntu repositories must also be compiled from source. Please follow the instructions below to compile the SPICE server and client.

These instructions are for installing SPICE 0.8 on 64-bit Ubuntu 11.04. It is not possible to install the SPICE server on any 32-bit system due to its reliance on 64-bit atomic operations. It is possible to build just the spice client on 32-bit systems, however - just follow the instructions below through the "SPICE client" section.

This how-to has been reported to work with Debian Squeeze, with one modification: you must install the "libpixman-1-dev" package from Wheezy, as the one provided with Squeeze is too old.

Please direct comments or questions about this guide to Mark Platek.

Initial set-up

Some standard tools are required:

sudo apt-get install build-essential autoconf git-core

Also, install some dependencies from the repositories:

sudo apt-get install libtool liblog4cpp5-dev libavcodec-dev libssl-dev xlibmesa-glu-dev libasound-dev libpng12-dev libfreetype6-dev \
libfontconfig1-dev libogg-dev libxrandr-dev kvm libgcrypt-dev libsdl-dev libnss3-dev libpixman-1-dev libxfixes-dev libjpeg8-dev \
libsasl2-dev python-pyparsing 

Finally, create a directory to compile from and descend into it:

mkdir spice-sources
cd spice-sources

Installing Dependencies


This library is what SPICE uses to emulate smart cards and smart card readers.

git clone git://people.freedesktop.org/~alon/libcacard
cd libcacard
sudo make install
cd ..

SPICE protocol headers

The first dependency to install is the spice protocol headers.

wget http://spice-space.org/download/releases/spice-protocol-0.8.0.tar.bz2
tar xjvf spice-protocol-0.8.0.tar.bz2
cd spice-protocol-0.8.0
mkdir m4
sudo make install
cd ..


SPICE requires a specific version of the celt low-latency audio codec ( Since it is unavailable in the Ubuntu repositories, it must also be compiled.

wget http://downloads.us.xiph.org/releases/celt/celt-
tar xvzf celt-
cd celt-
sudo make install
cd ..

SPICE client

This gives us spicec, the spice client. It's used to connect to SPICE guests.

wget http://spice-space.org/download/releases/spice-0.8.1.tar.bz2
tar xjvf spice-0.8.1.tar.bz2
cd spice-0.8.1
./configure --enable-smartcard
sudo make install
cd ..

This step is possible to perform on a 32-bit host; it's only installing the SPICE client.

Installing SPICE

SPICE server

Now, it's time to build the SPICE server itself. SPICE has been rolled into QEMU now, so this step amounts to installing a recent version of QEMU. In fact, we will be pulling the latest QEMU source code for version 0.14. Oddly enough, QEMU 0.14 is available in the Ubuntu repositories, but SPICE support is not included in the build.

First, we need to change an environment variable so that ./configure can find the spice protocol libraries we installed. You will need to set this variable anytime you want to use qemu with SPICE, so it's easiest to put it in your .bashrc.

echo "export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc
source ~/.bashrc

Now, we can continue with the installation. Note that if you require a specific softmmu target, you can add a list of them with the --target argument. By default, QEMU only builds with support for 32-bit x86 guests.

wget http://download.savannah.gnu.org/releases/qemu/qemu-0.14.0.tar.gz
tar xzvf qemu-0.14.0.tar.gz
cd qemu-0.14.0
./configure --enable-spice --enable-kvm --enable-io-thread --audio-drv-list=alsa,oss --enable-system
sudo make install

Now, we need to copy over some BIOS files that qemu will need to start SPICE VMs. We just need to put them in a location that QEMU expects them to be.

sudo cp pc-bios/vgabios-qxl.bin /usr/share/qemu/
sudo cp pc-bios/pxe-e1000.bin /usr/share/qemu/
cd ..

Now, qemu with SPICE support is installed in /usr/local/bin, and the ordinary system qemu is installed in /usr/bin. We'll make a shortcut command called 'qemu-spice' that you can invoke separately from the system qemu (which doesn't have SPICE support).

cd /usr/local/bin
sudo mv qemu qemu-spice

And that's it! You can invoke qemu-spice with the argument "-spice" to start a SPICE server.

Appendix: Ubuntu SPICE PPA

In past revisions of this page, Adam J. Lincoln's PPA containing debian packages for qcairo, qpixman, etc. and the spice client was mentioned. It no longer appears to be actively maintained, and almost certainly carries a very old, incompatible version of SPICE (0.4). If you wish to use SPICE, please compile it from source using the method described above.

SPICE on Fedora

It is considerably easier to install SPICE on a Fedora system, since rpms are available. The version of QEMU distributed with Fedora (14 and upward) natively supports SPICE, all you need to do is install QEMU using yum.

How To Use SPICE


To invoke the spice client, use the command

spicec -h <server hostname> -p <port number>


Invoking the spice server is rather more complex than the client, since you have to set the parameters of the virtualized guest. For example,

qemu-spice -spice port=5930,disable-ticketing -drive file=/path/to/image -vga qxl -device AC97 -usbdevice tablet -m 1024 -enable-kvm -net nic -net user

will start a SPICE server VM on port 5930 from the image at the supplied path, with:

  • qxl graphics (you need this for spice to be of any use)
  • an AC97 sound device
  • a tablet input device (using a virtualized tablet generally gives better results than a virtualized mouse)
  • 1024M of memory available
  • KVM support enabled (you really want this, as the guest is quite slow otherwise)
  • a user-controllable virtualized nic

It is also possible to use virtio if your system supports it; doing so will lead to significant performance gains for the guest. Modify the -drive argument like so:

-drive file=/path/to/image,if=virtio

And, modify the -net argument like so:

-net nic,model=virtio

When a SPICE server is started, its virtual guest boots and at any point until the guest is shut down a client can connect to and interact with the guest.

Special instructions for using a Windows guest

SPICE aims to provide a high-quality interface between the remote client and the guest VM. To this end, a SPICE-specific Windows driver has been written to enable smooth operation of the mouse, eliminating the "choppiness" that has before been a problem when running an XP guest. When you boot the SPICE Windows guest, follow these instructions to enable it. Note that you must start the guest with option -vga qxl in order for the mouse driver to work.


The VDI/Spice Project is aimed at providing COSI members and students with personalizable virtual machines. The project is still in its early stages, but development is ongoing; we are looking to integrate with OSCKAR and KIOSCKAR.

External Resources

SPICE User Manual

SPICE Homepage

Personal tools