2

I have no audio playback or recording in the new snap Firefox on Ubuntu 22.04. Somewhat uniquely, I run pulseaudio in system-wide mode (despite the warnings, long story). When I run snap connection firefox I can see that it is plugged into the audio-playback slot. Still, it won't connect to system-wide pulseaudio and play. Is there any way to connect a snap to system-wide pulseaudio?

I've tried replacing the snap with a apt version of firefox, which worked temporarily, but whenever I update the system it automatically re-installs the snap(!).

EDIT: sounds like it's possible to get ubuntu to keep the apt version during updates, so that's good. But I still want to know if it's possible to use the recommended snap version and also system-wide pulseaudio.

  • 3
    you can force the system not to re-install the snap using [this answer](https://askubuntu.com/a/1404401/1083397) – Esther Jul 21 '22 at 15:18
  • also you might need to add some user to `pulse-access` group – Esther Jul 21 '22 at 15:24
  • 1
    This sounds a bit like an XY problem to me. If system-wide Pulseaudio gives warnings, and causes problems, perhaps it would be better to put Pulseaudio back to running as a normal user and then solve the problem that causes some other way? – ArrayBolt3 Jul 21 '22 at 17:16
  • @arraybolt3 I've run pulseaudio system mode for many years. Firefox with apt works great with it, as does the rest of my system (another user is logged on in console mode running whole-home audio/snapcast/homeassistant, etc). So I can't just 'go back' to non system-wide PA – partofthething Jul 21 '22 at 20:36
  • I definitely did replace the snap. I confirmed it with the help/about dialog. Ubuntu just prioritizes reinstalling the snap when you upgrade you system as described in [this answer](https://askubuntu.com/questions/1399383/how-to-install-firefox-as-a-traditional-deb-package-without-snap-in-ubuntu-22/1404401#1404401). So a few days later, the snap was returning. – partofthething Jul 21 '22 at 23:45
  • 1
    Does this answer your question? [How to install Firefox as a traditional deb package (without snap) in Ubuntu 22.04 (jammy)](https://askubuntu.com/questions/1399383/how-to-install-firefox-as-a-traditional-deb-package-without-snap-in-ubuntu-22) – karel Jul 22 '22 at 02:42
  • That's useful as a workaround but does not help me understand how to do it with the snap distribution that Ubuntu is recommending we use from now on. – partofthething Jul 27 '22 at 17:23

1 Answers1

1

The latest snaps in 22.04 use pipewire, not pulseaudio. You can see it by checking /snap/*/current/usr/lib/x86_64-linux-gnu/

Still, it's possible to make pipewire work with the system-wide pulseaudio by using a network interface or a unix socket, which is largely compatible between the two.

For the network interface you'd need to pass PULSE_SERVER server env variable to the firefox snap like this:

echo "export PULSE_SERVER=<server>; /snap/firefox/current/usr/lib/firefox/firefox " | snap run --shell firefox

PULSE_SERVER should be either tcp:<hostname> if your pulseaudio server is listening on a network interface (check /etc/pulse/default.pa for load-module module-native-protocol-tcp) or unix:<pulseaudio socket file>

The variable is set in the shell of the snap, which is then used to start the main process.

AiB
  • 26
  • 1
  • Glorious, thanks. I actually got it working first with your command and then permanently by adding the `PULSE_SERVER=hostname.tld` to my `/etc/environment` file. – partofthething Nov 10 '22 at 19:01