Skip to content

Instantly share code, notes, and snippets.

@aspiwack
Created May 9, 2021 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspiwack/928f029de77fa4bd33ea1f81c4423cab to your computer and use it in GitHub Desktop.
Save aspiwack/928f029de77fa4bd33ea1f81c4423cab to your computer and use it in GitHub Desktop.
Notes on Pipewire on Ubuntu in 2021-05

Replace Pulseaudio

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.socket

Now, 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-pulseaudio

Disable 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 reboot

Enable 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-pulse

You 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”.

Replace Jack

Install package pipewire-audio-client-libraries

$ sudo apt install pipewire-audio-client-libraries

This package contains, in particular pw-jack.

Install a more recent Pipewire version

Get source package

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/experimental

It’s in a fresh directory because bzr writes in ../.

Build

Packages are built with the bzr tool. I followed this official tutorial from Ubuntu to set up the environment. Build the packages with

bzr builddeb

Install the packages

The 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 ./*.deb

We 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.

Restart services

$ systemctl --user daemon-reload
$ systemctl --user restart pipewire pipewire-media-session pipewire-pulse

Check that the update went well with

$ pactl info | grep "^Server Name"

This should display the version number of the new package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment