unable to start kvm (qemu 4.0) because of pulseaudio after upgrade to ubuntu 19.10
7,668
This is because change in audio configuration since qemu 4.0. You need to edit your vm configuration:
sudo virsh edit <your_vm>
Then replace your lines:
<qemu:commandline>
<qemu:env name="QEMU_AUDIO_DRV" value="pa"/>
<qemu:env name="QEMU_PA_SERVER" value="/run/user/1000/pulse/native"/>
</qemu:commandline>
with:
<qemu:commandline>
<qemu:arg value='-audiodev'/>
<qemu:arg value='pa,id=pa1,server=/run/user/1000/pulse/native'/>
</qemu:commandline>
I found this here: https://www.reddit.com/r/VFIO/comments/b1crpi/qemu_40_due_soon_might_bring_superb_audio_test_now/
Related videos on Youtube
Author by
user63726
Updated on September 18, 2022Comments
-
user63726 over 1 year
When starting the KVM (that was working fine in ubuntu 19.04) I am getting the following error:
Error starting domain: internal error: qemu unexpectedly closed the monitor: pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: warning: Using timer based audio emulation Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper callback(asyncjob, *args, **kwargs) File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb callback(*args, **kwargs) File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn ret = fn(self, *args, **kwargs) File "/usr/share/virt-manager/virtManager/object/domain.py", line 1279, in startup self._backend.create() File "/usr/lib/python3/dist-packages/libvirt.py", line 1080, in create if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self) libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: warning: Using timer based audio emulation
I have made the changes to the config file. I have added the following lines to reflect the change from qemu 3.1 to 4.0
<qemu:commandline> <qemu:env name="QEMU_AUDIO_DRV" value="pa"/> <qemu:env name="QEMU_PA_SERVER" value="/run/user/1000/pulse/native"/> </qemu:commandline>
If I remove these lines I cannot passthrough sound to pulseaudio.
yes the kvm audio user is me.
Any help will be appreciated. Is this a bug or a setup issue. my guest is windows 10 (1903)
-
user63726 over 4 yearsMy host is ubuntu 19.10 and the guest is windows 10. The KVM was created on ubuntu 19.04. I know that I need to change the config file to match the new version of qemu. Everything that I found did not work for me. It is not well documented how to change the config to the new version of qemu.
-
user63726 over 4 yearsThanks. I have a windows quest. The sound is not passed to pulseaudio. There is something else that I am missing. It is playing it in windows on "High definition audio device". I hear nothing because is is not passed.
-
randomei over 4 yearsWhen you start vm, open in ubuntu pavucontrol program, and check if there is qemu in playback programs. If no, then try to check for problem in qemu log: /var/log/libvirt/qemu/your_vm.log
-
user63726 over 4 yearsI got this error in the log file.
-
user63726 over 4 yearspulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
-
user63726 over 4 yearsyes I am user 1000, and I am in the libvirt group
-
randomei over 4 yearsI had the same problem, I've tried to configure apparmor without success and simpliest solution was to enable tcp protocol for pulse. Copy
/etc/pulse/default.pa
to~/.config/pulse/
then find:#load-module module-native-protocol-tcp
change this line to:load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
then edit your vm configuration:<qemu:commandline> <qemu:arg value='-audiodev'/> <qemu:arg value='pa,id=pa1,server=127.0.0.1'/> </qemu:commandline>
-
randomei over 4 yearsP.S. You should also restart pulsaudio with
pulseaudio -k