HowTo: Windows 7 32bit AND 64bit Sound with KVM / libvirt and the Spice client

UPDATE: Fixed and signed qxl video drivers

Hi all,

Yesterday I promised to post how I was able to get sound working with KVM / libvirt and the Spice client with Windows 7 32bit and 64bit. Here you go 🙂

First, get your spice client set up wherever you are going to run virt-manager.

On the server, I’m going to assume you set up kvm / libvirt already.

Install the spice server packages:

sudo apt-get update
sudo apt-get install qemu-kvm-extras qemu-kvm-spice kvm kvm-ipxe qemu-user

Modify /etc/libvirtd/qemu.conf to run the QEMU processes under the libvirtd group. You did add your user to the libvirtd group right? 😉

# The group ID for QEMU processes run by the system instance.
group = "libvirtd"

Reboot your server.

Create a new Windows 7 virtual machine but we will need to customize the settings:
Screenshot from 2013-02-10 14:19:07

Choose Spice as the Display adaptor:
Screenshot from 2013-02-10 14:21:04

Change Video hardware to QXL:
Screenshot from 2013-02-10 14:22:51

For sound, choose the appropriate hardware:

  • Windows 7 (32bit): ac97
  • Windows 7 (64bit): ich6
  • Windows Server 2008: ich6
  • Windows Vista (64bit): ich6
  • Windows Vista (32bit): ac97
  • Windows XP (32bit) ac97

For the hard disk and network cards, choose libvirt. You will need to download the libvirt iso image from Fedora. When you get to the point of choosing a drive to install Windows 7 onto, you will need to insert the image using virt-manager
Screenshot from 2013-02-10 14:34:06
Screenshot from 2013-02-10 14:36:00
When it finds the libvirt drivers, choose the one for Windows 7 32bit or 64bit as appropriate. Reinsert the Windows 7 image into virt-manager.

Log into your server and change the xml for your virtual machine replacing the graphics and video sections.

$ virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit
virsh # edit Win7-test
<graphics type='spice' autoport='yes'>
      <image compression='auto_glz'></image>
      <streaming mode='filter'></streaming>
      <mouse mode='client'></mouse>
      <clipboard copypaste='yes'></clipboard>
      <model type='qxl' vram='65536' heads='1'>
        <acceleration accel3d='yes' accel2d='yes'></acceleration>

After installing Windows, open up device manager (right click on my computer -> Properties -> Hardware -> Device Manager). Right click on any devices that are found and don’t have device drivers installed (yellow exclamation mark on them) and update the drivers. Choose the drivers on the libvirt iso image.

Okay. Almost done. If you try to play any audio, it will play but you won’t hear anything. Why? It seems that the QXL video driver is needed for sound to play remotely on the Spice client.

I’ve had trouble with the WIN32 QXL driver starting correctly in Windows XP and Vista although I haven’t had a problem with Windows 7 (32bit). With Windows 7 64bit, no binary drivers are provided. I can only suspect that because Windows 7 64bit requires properly signed drivers, the developers opted not to manage the signing themselves. So, I built the drivers for Windows XP (32bit), Windows 2008 (64bit), Windows 7 (32bit) and Windows 7 (64bit) yesterday.

QXL Drivers for Windows XP (32bit), Windows 2008 (64bit), Windows 7 (32bit) and Windows 7 (64bit)qxl video drivers

Right click on “SpiceTestCert.cer” and install it to accept the driver. Next update the VGA driver with the corresponding driver.

Note that since these were signed by me and not an actual company, you may need to force Windows 7 (64bit) to allow the driver to be loaded. See Installing Unsigned Drivers in Windows 7 by Trish Perry for three different methods. When you restart the vm, you should now hear sound if you’re using Spice.

The same method will work for Windows XP, Windows Vista and Windows Server 2008. I haven’t tried with Windows 8 yet.

Share Button