← Back to team overview

touch-packages team mailing list archive

[Bug 1246929] Re: no audio in KVM virtual machines : cannot select alsa or pa

 

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
Touch seeded packages, which is subscribed to pulseaudio in Ubuntu.
https://bugs.launchpad.net/bugs/1246929

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

Status in “libvirt” package in Ubuntu:
  Confirmed
Status in “pulseaudio” package in Ubuntu:
  Confirmed
Status in “virt-manager” package in Ubuntu:
  Confirmed

Bug description:
  I am on Ubuntu 13.10 desktop
  16GB ram
  asus sabertooth 990fx r2.0 motherboard
  amd 8346 cpu
  nvidia gtx650 video card

  Since upgrading to Ubuntu 13.10 audio no longer works in KVM.
  Checking SYSLOG I found this error being logged:

  Oct 31 15:32:31 bmullan-virtual-machine pulseaudio[1814]: [alsa-source-ID 21 Analog] alsa-source.c: ALSA woke us up to read new data from the device, but there was actually nothing to read!
  Oct 31 15:32:31 bmullan-virtual-machine pulseaudio[1814]: [alsa-source-ID 21 Analog] alsa-source.c: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
  Oct 31 15:32:31 bmullan-virtual-machine pulseaudio[1814]: [alsa-source-ID 21 Analog] alsa-source.c: We were woken up with POLLIN set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.

  brian

  ProblemType: Bug
  DistroRelease: Ubuntu 13.10
  Package: alsa-base 1.0.25+dfsg-0ubuntu4
  ProcVersionSignature: Ubuntu 3.11.0-11.17-generic 3.11.3
  Uname: Linux 3.11.0-11-generic x86_64
  ApportVersion: 2.12.5-0ubuntu2.1
  Architecture: amd64
  Date: Thu Oct 31 19:45:53 2013
  InstallationDate: Installed on 2013-10-31 (0 days ago)
  InstallationMedia: Ubuntu 13.10 "Saucy Salamander" - Beta amd64 (20131003)
  MarkForUpload: True
  PackageArchitecture: all
  SourcePackage: alsa-driver
  Symptom: audio
  Title: PCI/internal sound card not detected
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 04/09/2013
  dmi.bios.vendor: American Megatrends Inc.
  dmi.bios.version: 1708
  dmi.board.asset.tag: To be filled by O.E.M.
  dmi.board.name: SABERTOOTH 990FX R2.0
  dmi.board.vendor: ASUSTeK COMPUTER INC.
  dmi.board.version: Rev 1.xx
  dmi.chassis.asset.tag: To Be Filled By O.E.M.
  dmi.chassis.type: 3
  dmi.chassis.vendor: To Be Filled By O.E.M.
  dmi.chassis.version: To Be Filled By O.E.M.
  dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr1708:bd04/09/2013:svnTobefilledbyO.E.M.:pnTobefilledbyO.E.M.:pvrTobefilledbyO.E.M.:rvnASUSTeKCOMPUTERINC.:rnSABERTOOTH990FXR2.0:rvrRev1.xx:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
  dmi.product.name: To be filled by O.E.M.
  dmi.product.version: To be filled by O.E.M.
  dmi.sys.vendor: To be filled by O.E.M.

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