1

I am trying to get audio working on a Win10 Guest running on a Ubuntu host following this guide https://blog.zerosector.io/2018/07/28/kvm-qemu-windows-10-gpu-passthrough/ .

GPU pass through works however I have issues with audio. The section that describes how to get audio working requires command line arguments to be passed to the VM by editing the first line of the xml file and then adding these lines at the end:

<qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
<qemu:env name='QEMU_PA_SAMPLES' value='8192'/>
<qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='99'/>
<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>

The issue that I am having is that when I get to the part where I edit my VM configuration with virsh edit win10 the changes are not saved and the following error occurs:

Failed. Try again? [y,n,i,f,?]: 
error: XML document failed to validate against schema: Unable to 
validate doc against /usr/share/libvirt/schemas/domain.rng
Element domain has extra content: env

I tried both f and i responses, but the xml file does not save and the audio still does not work in the VM.

Doing some research I found that modifying the first line of the xml file from

<domain type='kvm'> to 
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

does not have an effect as that schema does not exist anymore (404s). Replacing it with the .rng alternative 'https://libvirt.org/schemas/domain.rng' does not work either.

My question is: How do I pass the required commandline arguments to the machine that already exists and is configured through virt-manager?

EDIT: I decided to try again and I managed to figure it out, thanks to Michael Hampton's reply. Check the answer below.

  • <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> works fine for me. What is the problem you had with it? – Michael Hampton Jan 21 at 15:36
  • Adding <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> at the start of the file and then adding the environment variables specified creates the error that I described above. It is as if the the xml validation fails because it does not recognise the env parameters I am trying to pass. – Dan B Jan 21 at 23:57
  • If you've solved the problem, you should post it below as an answer. People will not understand it as an edit to the question. – Michael Hampton Jan 22 at 0:11
0

I decided to try again and I managed to figure it out, thanks to Michael Hamptons reply.

Turns out when you want to pass environment variables to the like I was trying to do, you must also include

<qemu:commandline>
...
</qemu:commandline>

before and after the environment variables. The final section of my xml file looks like this:

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

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.