Getting Audio on Gaming VM

I’ve successfully created a Gaming VM with GPU Passthrough on Fedora 29, but I can’t seem to get audio from my VM to host. I’m running Windows 10 1803 on guest and Fedora 29 on Host.
Could I please get some help to get this working?

Extra Info: I’m using kvm.ignore_msrs=1 in my /etc/default/grub to get Windows 10 version 1803 working, as without it, I get boot breaking errors in the VM.

Made the following thread a while ago. Look at the audio section.

The MSRS thing is needed because certain hardware manufacturers like to flood the system with msrs messages which are unsupported by KVM/QEMU I to have it disabled because some games BSOD my VM.

I read your article before, and I couldn’t get it to work, but I’ll try again and get back to the thread

Following the guide on your article, I get:

Error starting domain: internal error: qemu unexpectedly closed the monitor: 2018-12-31 22:38:40.789+0000: Domain id=1 is tainted: custom-argv
2018-12-31 22:38:40.789+0000: Domain id=1 is tainted: host-cpu
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init pa' audio driver pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not initpa’ audio driver
Failed to create secure directory (/home/bradley/.config/pulse): Permission denied

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/libvirtobject.py”, line 66, in newfn
ret = fn(self, *args, **kwargs)
File “/usr/share/virt-manager/virtManager/domain.py”, line 1344, in startup
self._backend.create()
File “/usr/lib64/python3.7/site-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: 2018-12-31 22:38:40.789+0000: Domain id=1 is tainted: custom-argv
2018-12-31 22:38:40.789+0000: Domain id=1 is tainted: host-cpu
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init pa' audio driver pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not initpa’ audio driver
Failed to create secure directory (/home/bradley/.config/pulse): Permission denied

1 Like

Added the helpdesk tag for you OP.

1 Like

Seems to be a permission error.

Were you supposed to do a chmod?

Doesn’t say so in @kriss120’s article, but I’ve tried “chmod 777 -R ~/.config/pulse” and that didn’t seem to do anything.

1 Like

Virt-manager is using “Libvirt URI: qemu:///system” not “Libvirt URI: qemu:///session” (user session). I’m not sure if this is an issue.

This is a problem that occurs because libvirt most likely is running as root and not your user. This results in it not being able to access the PA configs.

What kernel are you running on?
Would you also be able to paste the part of the /etc/libvirt/qemu.conf here?

2 Likes

$ uname -r
4.19.10-300.fc29.x86_64

/etc/libvirt/qemu.conf
nographics_allow_host_audio = 1

user = “bradley”
#group=“root”

You probably did, but did you reboot or restart the daemon for both libvirt and PA after updating the configs?

Will try to remember back to what I did exactly, try to replicate my setup on my system again, been a while since I set this up. It is most definetly the same problem that I had half a year ago, though it was ubuntu but I think it should be resolved in the same way.

All I can say right now is that the problem is permissions, and should be solvable by making sure libvirt has permissions to read the PA config files in your user dir.

Yes, I did reboot. How would I make sure libvirt has read permissions to my ~/.config/pulse directory? As I’ve said earlier, I tried chmod 777 -r ~/.config/pulse, but that didn’t seem to help.

I have encountered the same permission error, turned out to be caused by selinux.
You can test this by running sudo echo 0 > /selinux/enforce and then trying to start your VM.

If that works then it confirms that selinux is the root of the problem. Restarting your host will reset selinux to enforcing, so you can either set selinux to permissive, or create a custom rule with audit2allow.

I can post the rule that I generated if you’d like. :slight_smile:

1 Like

Finished the holidays! And I used “$ sudo setenforce 0” to temporarily turn off selinux, and that seemed to fixed it! There’s still audio artifacts and crackling, but I think I can handle that myself. Thank you for all your help.

2 Likes