Using SPICE with QEMU/KVM on Ubuntu 12.04

SPICE is a new remote desktop protocol, which is being used a lot in combination with the QEMU emulator on KVM. One of the biggest advantages of SPICE over VNC or RDP is that it works at near-native speeds, you can watch full screen video without any delay! SPICE is being developed by Red Hat and a such is supported best on RHEL-like distro’s.

However, I run Ubuntu on my laptop. For my university studies I need to use a Windows VM a lot, so I also wanted the near-native performance of SPICE. Unfortunately Ubuntu’s package for SPICE/QEMU/KVM leaves some to be desired. This is a description of how I set up KVM on my box:

Preparation

  • Install qemu and spice:
$ sudo apt-get install spice-client-gtk python-spice-client-gtk qemu-kvm-spice virt-manager virt-viewer kvm libvirt-bin
  • Add your useraccount to the libvirtd group:
$ sudo adduser mtak libvirtd
  • Create a new VM using the virt-manager tool (Virtual Machine Manager from Unity).
  • Install your 32-bit Windows OS in VNC mode.
  • Install the SPICE guest tools on the Windows OS. You can download these from here.

Turn on SPICE

  • Change the emulator option in the VM config to /usr/bin/kvm-spice using:
$ virsh edit vmname
  • Reconfigure the VM’s display mode to SPICE mode using the virt-manager tool.
  • Reboot the Windows VM.
  • Switch to qlx video mode using the virt-manager tool or the virsh edit command.

Keep in mind that SPICE will only start working after the drivers have been loaded. This means that the screen will stay black during booting and that you will only see something when the system boots up to the login screen. If you need to do some maintenance on your Windows VM, switch back to VNC and Cirrus video adapter.