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.