No audio playback after Whonix templates upgrade

Hi,

Recently, I upgraded both Whonix qorkstation and gateway templates through Qubes Template Manager.

Result: no audio when playing videos in qubes based on Whonix Workstation (neither in Tor Browser, nor in VLC).

Looking at journalctl -f both in dom0 and domUs while trying this shows nothing interesting in dom0. In the domU I see these 2 lines when starting the video in Tor Browser:

qubes.VMShell-dom0[1202]: [Child 10710, MediaDecoderStateMachine #1] WARNING: 7f17c77aa280 OpenCubeb() failed to init cubeb: file /var/tmp/build/firefox-f4e58357fe60/dom/media/AudioStream.cpp:281

qubes.VMShell-dom0[1202]: [Child 10710, MediaDecoderStateMachine #1] WARNING: Decoder=7f17d1a7ed00 [OnMediaSinkAudioError]: file /var/tmp/build/firefox-f4e58357fe60/dom/media/MediaDecoderStateMachine.cpp:4604

When testing in VLC, in dom0 I see:

[ 3762.297220] dom0 kernel: loop: Write error at byte offset 709730304, length 4096.
[ 3762.297232] dom0 kernel: I/O error, dev loop8, sector 1386192 op 0x1:(WRITE) flags 0x8800 phys_seg 2 prio class 2
... # repeats 8-9 times

VMs based on other templates (e.g. Debian 12, using pulseaudio-qubes, not pipewire) play audio just fine. The pipewire service and socket are active and running in dom0. There are no pulseaudio services in dom0.

IIUC, this is an issue with pipewire (I still can’t figure what exactly). Perhaps uninstalling pipewire and installing pulseaudio would fix it. I tried that in the AppVM but nothing changed.

Before doing anything to the template:

Why is this happening and how do you approach it?

1 Like

What’s the output of this command in whonix workstation app qube?

systemctl --user status pipewire wireplumber | cat
$ systemctl --user status pipewire wireplumber | cat
Unit pipewire.service could not be found.
Unit wireplumber.service could not be found.

Do you have these packages installed?

 pipewire-qubes
 pipewire-pulse
 wireplumber
 rtkit
 dbus-user-session

http://forums.dds6qkxpwdeubwucdiaord2xgbbeyds25rbsgr73tbfpqpt4a6vjwsyd.onion/t/port-from-pulseaudio-to-pipewire-for-audio-support/16879/39

Do you have these packages installed?

In Whonix Workstation (where audio doesn’t play):

pipewire-qubes - yes
pipewire-pulse - no
wireplumber - no
rtkit - no
dbus-user-session - no

In the Debian 12 minimal custom (where audio plays):

pipewire-qubes - no
pipewire-pulse - no
wireplumber - no
rtkit - no
dbus-user-session - no

qubes-whonix/debian/control at master · Whonix/qubes-whonix · GitHub
http://forums.dds6qkxpwdeubwucdiaord2xgbbeyds25rbsgr73tbfpqpt4a6vjwsyd.onion/t/port-from-pulseaudio-to-pipewire-for-audio-support/16879/39

In the end, what should be done?

I guess you have pulseaudio instead of pipewire in your Debian 12 minimal template.
And in Whonix Workstation you have pipewire but not all required packages installed.
The fix for missing pipewire packages in Whonix Workstation is not yet in stable repository so I think you’ll need to install the missing packages in your Whonix Workstation template manually:

sudo apt install --no-install-recommends pipewire-qubes pipewire-pulse wireplumber rtkit dbus-user-session

I follow your instruction (in a disposable) but even after that nothing changes.

Is there anything additional perhaps?

Try to install them in a cloned Whonix Workstation template.
Maybe these packages need to be present during boot. Or maybe you need to restart some services after installing the packages.

I have the same symptoms with tor browser videos before + after installing those packages in a workstation template. I think this was working a few weeks back, but couldn’t swear to it.

Installed alsa-utils to test with speaker-test:

[workstation user ~]% speaker-test               

speaker-test 1.2.8

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
Playback open error: -2,No such file or directory
zsh: exit 1     speaker-test

Following other forum threads here with that error didn’t turn anything up for me.

I’m using a separate sys-audio, and the dispvm does register in the volume control there. It wasn’t moving to sys-audio that broke this.

What’s the output of these commands?

dpkg -l | grep -e pipewire -e pulse -e wireplumber -e rtkit -e dbus-user-session
systemctl --user status pipewire wireplumber | cat

You can test audio using this command:

pw-play /usr/share/sounds/freedesktop/stereo/audio-channel-front-center.oga
1 Like

Try to install them in a cloned Whonix Workstation template.

That worked. Thanks!

Maybe these packages need to be present during boot. Or maybe you need to restart some services after installing the packages.

It seems so. For some reason, I was unable to manually start the services - wireplumber in particular failed with errors.

BTW, what is the big thing about moving from pulseaudio to pipewire? What makes the latter better and preferred?

That works where aplay doesn’t. torbrowser also works now.

I guess this was the reason:

Fedora 34 [will be switching to PipeWire], which brings security and functionality improvements.

Motivation

Linux has no unified framework for exchanging multimedia content between applications or even devices. In most cases, developers realized that a user-space daemon is needed to make this possible:

  • For video content, we typically rely on the compositor to render our data.
  • For video capture, we usually go directly to the hardware devices, with all security implications and inflexible routing that this brings.
  • For consumer audio, we use PulseAudio to manage and mix multiple streams from clients.
  • For Pro audio, we use JACK to manage the graph of nodes.

None of these solutions (except perhaps to some extent Wayland) however were designed to support the security features that are required when dealing with flatpaks or other containerized applications. PipeWire aims to solve this problem and provides a unified framework to run both consumer and pro audio as well as video capture and processing in a secure way.

https://docs.pipewire.org/page_overview.html

Copy of the edit for email users.

Motivation

Linux has no unified framework for exchanging multimedia content between applications or even devices. In most cases, developers realized that a user-space daemon is needed to make this possible:

  • For video content, we typically rely on the compositor to render our data.
  • For video capture, we usually go directly to the hardware devices, with all security implications and inflexible routing that this brings.
  • For consumer audio, we use PulseAudio to manage and mix multiple streams from clients.
  • For Pro audio, we use JACK to manage the graph of nodes.

None of these solutions (except perhaps to some extent Wayland) however were designed to support the security features that are required when dealing with flatpaks or other containerized applications. PipeWire aims to solve this problem and provides a unified framework to run both consumer and pro audio as well as video capture and processing in a secure way.

PipeWire: Overview

Thanks for the info!