port from pulseaudio to pipewire for audio support

This is now in the testers repository.

1 Like

There is a small problem with this change: pipewire-qubes only Recommends: pipewire-pulse, which technically is correct (one can have a system with just pipewire and no pulseaudio). But such system is not very useful in practice - most applications connect to pulseaudio (either real one, or pipewire-pulse). And since Whonix packages are installed with --no-install-recommends, pipewire-pulse isn’t installed in the end.

So, I’d recommend adding pipewire-pulse to the list in qubes-whonix-workstation-packages-recommended too.

2 Likes

Thank you!

Done.

1 Like

The upgrade isn’t clean… When updating a template that had pulseaudio (and pulseaudio-qubes) installed, apt dist-upgrade skips updating qubes-whonix-workstation-packages-recommended, I assume because that requires removing pulseaudio-qubes. But when doing explicit apt install qubes-whonix-workstation-packages-recommended, it does offer an update and removal of pulseaudio-qubes.

Honestly, I’m not sure how to handle this situation best. TBH, I’m not sure why it wasn’t an issue in release upgrade R4.1 → R4.2. We did need explicit pulseaudio-pipewire step in the upgrade tool for Fedora templates, but not for Debian. Maybe it’s due to which package has those dependencies (pipewire-qubes has Conflicts: pulseaudio-qubes and Recommends: pipewire-pulse - so, it’s the same package pulling one and removing the other, while on Whonix, due to --no-install-recommends it’s a different package pulling in pipewire-pulse than removing pulseaudio-qubes). I don’t fully understand this, could be something else. One thing to try might be adding Conflicts: pulseaudio-qubes to qubes-whonix-workstation-packages-recommended, but see below.

And to make things worse, pipewire-qubes isn’t a thing on R4.1 yet, which leads to another dependency issue… This issue is relevant only for a little less than 3 months (until R4.1 EOL), but still.

Maybe, for the time being, the better approach would be a less strict migration, like Depends: pipewire-qubes | pulseaudio-qubes, so it would choose pipewire for new builds, but not switch to it if pulseaudio is already installed? But in that case, I’m not sure what to do about pipewire-pulse requirement, does Debian support grouping in dependencies like Depends: (pipewire-qubes, pipewire-pulse) | pulseaudio-qubes ? If not, I guess it can be written as Depends: pipewire-qubes | pulseaudio-qubes, pipewire-pulse | pulseaudio-qubes. As for the conflict with pulseaudio, I’m not sure how to do it. Adding Conflicts: pulseaudio-qubes will break audio on R4.1. Maybe some Conflicts: pulseaudio-qubes | pipewire-qubes would work? Probably not…

The underlying issue with this migration is that pipewire and pulseaudio cannot run at the same time - there can be only one audio daemon connecting to dom0 (or other audiovm). Currently it’s achieved with package conflict. Maybe a more robust solution would be to avoid package conflict and add some runtime detection (if pulseaudio-qubes detects pipewire installed/enabled, it will not start)?

Any preference?

I do have R4.1 and R4.2 test systems, with Whonix Workstation 17 template from before this change, so I can test various options, for example if you upload some package to try to some repository (developers one?).

1 Like

This is probably good. As far as I know, the first named package in the line pipewire-qubes gets preferred, if available.

Right. I guess it won’t switch automatically then.

Hard to speak with certainty about these things. Not really well documented anywhere.

What makes this hard is that package upgrades are hard to test. I am not aware of any way to simulate this without actually attempting such upgrades. We’re kinda doing a learning by doing / reverse engineering / tinkering based approach.

No, I don’t think so. From all the debian/control files I looked at during my lifetime, I don’t remember seeing something like that. There are versioned Depends: but that looks difficult, speak error-prone. One solution might be to create a meta package qubes-audio-support-pipewire to avoid the non-existing grouping syntax support.

But a simpler solution perhaps…

 pipewire-qubes | pulseaudio-qubes,
 pipewire-pulse | pulseaudio-qubes,

Meaning:

  • If pipewire-qubes is available, prefer it. Otherwise fall back to pulseaudio-qubes.
  • If pipewire-pulse is available, prefer it. Otherwise fall back to pulseaudio-qubes.
  • The fact that pulseaudio-qubes is mentioned twice as a dependency shouldn’t cause any issues.

I am not sure but that sounds like a higher likelihood of introducing regressions. Happy to avoid if we can avoid it at the meta package level.

This is now in the developers repository.

Please let me know if that looks good enough and is functional.

Looks to work good:

  • R4.1: update is clean, pulseaudio-qubes remain installed
  • R4.2 that still has pulseaudio-qubes: update is clean, pulseaudio-qubes remain installed
  • R4.2 that has pipewire-qubes installed already: update is clean, pipewire-pulse is pulled in too

And then, if one would like to migrate:
R4.2 that still has pulseaudio-qubes: apt install pipewire-qubes pulls in pipewire-pulse too, and removes pulseaudio-qubes

1 Like

Excellent. So that’s resolved. :slight_smile:

1 Like

I see this update is still only in the developers repository. Is it time to push it to testers or maybe stable?

1 Like

Done.

May 19 07:22:39 host wireplumber[1158]: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
May 19 07:22:39 host wireplumber[1158]: found session bus but no portal
May 19 07:22:39 host wireplumber[1158]: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host wireplumber[1158]: could not set nice-level to -11: No such file or directory
May 19 07:22:39 host wireplumber[1158]: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire[1156]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
May 19 07:22:39 host pipewire[1156]: mod.rt: found session bus but no portal
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: found session bus but no portal
May 19 07:22:39 host pipewire[1156]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire[1156]: mod.rt: could not set nice-level to -11: No such file or directory
May 19 07:22:39 host pipewire[1156]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: could not set nice-level to -11: No such file or directory
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host wireplumber[1158]: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire[1156]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host pipewire-pulse[1159]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
May 19 07:22:39 host wireplumber[1158]: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
May 19 07:22:39 host wireplumber[1158]: PipeWire's libcamera SPA missing or broken. libcamera not supported.
May 19 07:22:39 host wireplumber[1158]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NameHasNoOwner

The saga continues… I did a template build for R4.3 (but I’m pretty sure it will affect next R4.2 build too), and wireplumber wasn’t installed, which is necessary for pipewire to work (wireplumber connects streams in pipewire to appropriate outputs - without it, applications basically send audio to /dev/null). Since this isn’t an issue on update, I guess it has to do with skipping “recommended” packages on update. pipewire-bin only recommends wireplumber. I guess it needs yet another dependency to the whonix meta-package…

1 Like

Because Qubes package pipewire-pulse only Recommends: wireplumber it won’t be installed during a build script that uses --no-install-recommends. Furthermore, during apt-get dist-upgrade, Debian also does not install packages listed under Recommends:.

Generally, Debian Recommends: mechanism and the absence of weak dependencies is a very messy aspect of APT.

Is there a Qubes package which Depends: on wireplumber?

(And pipewire-media-session-pulseaudio?)

Otherwise I would have to append do this…

Package: qubes-whonix-workstation-packages-recommended
Architecture: all
Depends: qubes-thunderbird,
 qubes-gpg-split,
 qubes-pdf-converter,
 qubes-img-converter,
 pipewire-qubes | pulseaudio-qubes,
 pipewire-pulse | pulseaudio-qubes,
 ${misc:Depends}

The line which I should append…?

 wireplumber | pulseaudio-qubes,

But I would prefer if this would be implemented upstream in Qubes, i.e. if there was a Qubes package that Depends: on all the recommended packages.


Should rtkit be installed by default?

Debian packages, especially for user apps seems to assume recommended packages gets installed too… TBH, I’m not sure what is the use case for pipewire without wireplumber, maybe if somebody has own custom replacement?
Qubes current packaging works well in standard Debian template, where recommended packages gets installed. In this specific case, theoretically we could add strict dependency on wireplumber to pipewire-qubes, but since the issue affects Whonix only in practice it feels a bit wrong (and would undermine the weaker dependency for all non-Whonix Debian template users, if there is actually a point of the setup with wireplumber removed…).

Back to specifics:

Given pipewire-pulse recommends wireplumber | pipewire-media-session-pulseaudio, I think the line should be:

wireplumber | pipewire-media-session-pulseaudio | pulseaudio-qubes

(if that’s legal syntax).

As for rtkit, that’s a very good question. It gets installed in standard Debian template, but not in Whonix. Generally sound seems to work fine on Whonix without it, at least not under much load. But I’ve seen one report suggesting it may be an issue: Garbled audio on Whonix but not Fedora via PCI - General - Qubes OS Forum (this may or may not be related to rtkit, and also it isn’t using pipewire-qubes nor pulseaudio-qubes).

No idea. I would say keep it simple Install it by default. Too much configurability makes things unmaintainable.

Legal syntax but that would mean, “the dependency shall be satisfied by either wireplumber or pipewire-media-session-pulseaudio or pulseaudio-qubes”.

Let’s try that. And let’s also install rtkit then.

Shouldn’t dbus-user-session package be listed as dependency as well?
The pipewire depends on pipewire-bin and pipewire-bin only recommends dbus-user-session.
Without dbus-user-session pipewire won’t work:

May 30 16:07:58 host systemd[827]: Started pipewire.service - PipeWire Multimedia Service.
May 30 16:07:58 host systemd[827]: Started wireplumber.service - Multimedia Service Session Manager.
May 30 16:07:58 host pipewire[2237]: spa.dbus: Failed to connect to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 30 16:07:58 host pipewire[2237]: mod.portal: Failed to connect to session bus: Input/output error
May 30 16:07:58 host wireplumber[2238]: Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY
May 30 16:07:58 host wireplumber[2238]: 0x56f0d7a40000: leaked proxy 0x56f0d7ae90d0 id:3
May 30 16:07:58 host wireplumber[2238]: disconnected from pipewire
May 30 16:07:58 host systemd[827]: wireplumber.service: Main process exited, code=exited, status=70/SOFTWARE
May 30 16:07:58 host systemd[827]: wireplumber.service: Failed with result 'exit-code'.
May 30 16:07:58 host systemd[827]: wireplumber.service: Scheduled restart job, restart counter is at 1.
May 30 16:07:58 host systemd[827]: Stopped wireplumber.service - Multimedia Service Session Manager.
May 30 16:07:58 host systemd[827]: Started wireplumber.service - Multimedia Service Session Manager.
May 30 16:07:58 host wireplumber[2248]: Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY
...
May 30 16:07:59 host systemd[827]: wireplumber.service: Start request repeated too quickly.
May 30 16:07:59 host systemd[827]: wireplumber.service: Failed with result 'exit-code'.
May 30 16:07:59 host systemd[827]: Failed to start wireplumber.service - Multimedia Service Session Manager.

Does installing dbus-user-session help for this issue?

Yes, sound works with dbus-user-session package installed and there is no wireplumber or pipewire errors about dbus.

1 Like

All done.

This is now in the testers repository.