Libvirt / Virt-Manager and host Alsa based sound
======================================
I have battled the same problem ... and managed to get it working on Trusty

(1) this is all down to AppArmor
(2) In order to run ALSA you will need the following apparmor entries, 
preferably in ...abstractions/libvirt-qemu
 # ================ Changes ================ #
  /{dev,run}/shm/pulse-shm* rw,
  @{HOME}/.config/puls** rwk,
  @{HOME}/* r,
  # ================ Changes ================ #

In my case I run libvirt as Root because it is accessing virtio and vga 
passthrough.  I've also added dev/vfio to support vfio based PCI passthrough ie.
  /dev/vfio/* rw,

The VM definition xml contains the following
  <qemu:commandline>
    <qemu:env name='QEMU_ALSA_DAC_BUFFER_SIZE' value='512'/>
    <qemu:env name='QEMU_ALSA_DAC_PERIOD_SIZE' value='170'/>
    <qemu:env name='QEMU_AUDIO_DRV' value='alsa'/>
  </qemu:commandline>

This setup works very nicely with the following (both defined and working, in 
guest select preferred mode, I prefer the HDA device) 
   <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' 
function='0x0'/>
    </sound>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg 
value='ioh3420,bus=pcie.0,addr=1c.1,multifunction=on,port=2,chassis=2,id=root.2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ich9-intel-hda,bus=root.2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='hda-duplex,bus=hda.0'/>
  </qemu:commandline>

I prefer the second (HDA) for quality - Note that I am using the Q35
motherboard. Furthermore Pulseaudio was much easier to get working BUT
running system wide (because libvirt runs as root) is not good and it
has terrible lag and is not suitable for somepurposes eg. game machines

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1246929

Title:
  no audio in KVM virtual machines : cannot select alsa or pa

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1246929/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to