R4.1 Audio does not go from appvm to dom0 in default installation

Fully solved, at least for a given scenario, I can use online meeting software in my appvms. It took me 3 full days.

Summary is here. This does not cover too many details, and you are welcome to make it more complete.

This mainly apply to using Intel Tiger Lake Audio Controller on Qubes R4.1.

  1. Bootstrap sys-audio according to Setting up an audio VM - #24 by hamenarin .
    Most detail is similar, while the template VM of sys-audio may need more work.
    The template VM of sys-audio start from fedora-34-xfce, and install qubes-audio-daemon, qubes-core-admin-client; for better debugging I suggest installing strace gdb busybox pulseaudio-utils but they does not seem necessary.
    Note that the post did not mention that one should manually configure PCI Passthrough for theaudio device. Also, step 7 in the mentioned post does not seem necessary in R4.1 now since qvm-start-daemon startup on boot automatically now.
    Also, /etc/qubes/policy.d/50-sys-audio.policy need more rules than what the post mentions. Add them in later steps until you do not see complaint from sys-audio.

  2. Edit /etc/xdg/autostart/qubes-pulseaudio. start-pulseaudio-with-vchan is an app that is only useful for client VMs, not for a sys-audio. Let’s hack and edit start-pulseaudio-with-vchan into pulseaudio.
    Yes, naked pulseaudio with no arguments.
    Note that pulseaudio and pacat-simple-vchan all write their log by default in ~/.xsession-errors, in case you need it.

  3. /etc/pulse/default.pa is the config file that a naked pulseaudio command uses.
    Look at this part

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

Uncomment the upper part and comment the lower part (load audio drivers statically, not automatically)
Also load-module module-alsa-source device=hw:1,0 the device=... part should be deleted. The final result of the above part should be:

load-module module-alsa-sink
load-module module-alsa-source
load-module module-null-sink
load-module module-pipe-sink
  1. wait for the patch of https://github.com/QubesOS/qubes-issues/issues/7288
  • or, recompile a version of pacat-simple-vchan by yourself
  • or, like me, kill the original pacat-simple-vchan and hack the bind() argument with gdb by b bind; r; p *(short*)$rsi=1; c when manually running pacat-simple-vchan with correct arguments
  1. Above initialized the template for sys-audio. The kernel version of sys-audio does not seem to matter, as both default and latest versions seem good.

  2. Set audiovm of other VMs. In dom0:

qubes-prefs default_audiovm ''
qvm-prefs appvmneedingaudio audiovm sys-audio
  1. Make sure that the headset is plugged and start sys-audio

  2. Run pavucontrol in sys-audio and speak to see whether input device works; you should hear from parole /usr/share/sounds/alsa/Front_Center.wav. If input device and output device do not work inside sys-audio, you need to try better; otherwise congratulations and you can continue to the last step

  3. Run your appvm needing audio. In dom0 pass mic to your appvm, and if pulseaudio agent not running error message appears, check out step 4 in this post. When mic has been passed, your appvm should be able to play sounds and record from mic. Congratulations.

Note that I can only make it work when I plug my headphone, and I did not test whether restarting some of VMs or suspension makes the sound work. However I believe this is a good start.

3 Likes