0

When we use Spice in a virtual machine under KVM/qemu/libvirt, the QEMU_AUDIO_DRV is set to spice by default.
My host (debian-Stretch) use a good sound card (Xonar DX) and a better sound driver (pulseaudio,alsa).
How to use in a virtual machine spice for the graphic aspect and pulseaudio or alsa for the sound aspect (whatever the guest OS) ?

Note 1: in the domain.xml, I added:

<qemu:commandline>
  <qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
  <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
</qemu:commandline>

Now, in domain.log, I see:

QEMU_AUDIO_DRV=pa QEMU_PA_SERVER=/run/user/1000/pulse/native

Well but I don't know if my guest uses pulseaudio or not because domain.xml has the following section:

<sound model='ich6'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>

Note 2: other try:

<qemu:commandline>
  <qemu:env name='QEMU_AUDIO_DRV' value='alsa'/>
</qemu:commandline>

No sound.

0

PulseAudio normally accepts only a connection from one user. To mitigate this you could either

  1. run QEMU as user 1000 - Edit /etc/libvirt/qemu.conf and add/change user = "<user>" or
  2. allow PulseAudio to accept anonymous connections.
  • My solution works for pulseaudio (with the 1000 user) but not with alsa. Shall I also remove the ich6 section ? – Bertaud Feb 1 '18 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.