Ubuntu 21.04 comes with Pipewire pre-installed. A pipewire service is
running, but it’s doesn’t handle audio by default. For this you need
to install a pipewire-pulse service. The (preinstalled) pipewire
package provides such a service as documentation. First let’s copy it
in Systemd’s space.
$ cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /usr/lib/systemd/user/
# It's pipewire-pulse.* because we are also copying pipewire-pulse.socketNow, a VERY IMPORTANT step which isn’t documented in many places. I found it on Debian’s wiki. I’m not sure what this does precisely, but if you don’t do this next step, Pipewire will start with 0 node. It’s really easy to miss.
$ sudo touch /etc/pipewire/media-session.d/with-pulseaudioDisable Pulseaudio (replace disable --now with stop if you don’t want it to persist at reboot)
$ systemctl --user disable --now pulseaudio.service pulseaudio.socket
$ systemctl --user mask pulseaudio.service pulseaudio.socket
# This last step seems necessary to prevent Pulseaudio from starting
# automatically after a reboot. I thought disable did that
# already. But it doesn't.
# Skip that last line if you are just testing out and want to be back
# on Pulseaudio after rebootEnable Pipewire (replace enable --now with start if you don’t want to persist at reboot)
# First stop the Pipewire service because we changed its configuration
# by adding the with-pulseaudio file. We want Pipewire to pick up on
# the configuration change
$ systemctl --user stop pipewire
$ systemctl --user enable --now pipewire pipewire-pulseYou should now have sound working on top of Pipewire. You can check
your sound the usual way. Pulseaudio should work. You can even
configure your sound with your Settings panel or with pavucontrol.
You can check that the sound server is indeed run by Pipewire with
$ pactl info | grep "^Server Name"
Server Name: PulseAudio (on PipeWire 0.3.24)Note how the response says “on Pipewire”.
Install package pipewire-audio-client-libraries
$ sudo apt install pipewire-audio-client-librariesThis package contains, in particular pw-jack.
To install the more recent versions of Pipewire, I wait until they
land in the applied/debian/experimental branch of the Ubuntu source
repository.
$ mkdir pipewire-ubuntu
$ git clone https://git.launchpad.net/~usd-import-team/ubuntu/+source/pipewire
$ git checkout applied/debian/experimentalIt’s in a fresh directory because bzr writes in ../.
Packages are built with the bzr tool. I followed this official
tutorial from Ubuntu to set up the environment. Build the packages
with
bzr builddebThe package should get copied or symlinked to ../. Though sometimes
there is a build error, no idea what triggers it. Then the packages
are still in ../build-area.
In the directory where all the .deb packages are:
sudo dpkg --force-depends -i ./*.debWe need --force-depends because there are many packages. It tells dpkg
to install packages even if their dependencies are not met. This
prevents us from having to install them in order, which would be a
bother.
$ systemctl --user daemon-reload
$ systemctl --user restart pipewire pipewire-media-session pipewire-pulseCheck that the update went well with
$ pactl info | grep "^Server Name"This should display the version number of the new package.