How to Enable PipeWire Audio Service to Replace PulseAudio in Ubuntu 21.04

May 10, 2021 — 8 Comments

Want to try out the Pipewire sound server? It’s easy to do this in Ubuntu 21.04, and here’s how!

PipeWire is a server for handling multimedia on Linux. Its most common use is for Wayland and Flatpak apps to implement audio and video playback and capture with minimal latency. And it offers seamless support for PulseAudio, JACK, ALSA, and GStreamer based applications.

Replace PulseAudio with Pipewire in Ubuntu 21.04:

Ubuntu 21.04 has enabled support for pipewire officially. And here’s how I enabled it in my laptop:

Don’t do this in production machine! Replacing existing audio service in Ubuntu is possible but the experience is currently not guaranteed to be perfect or free of issues and bugs.

1.) Firstly, open terminal either from system application launcher or by pressing Ctrl+Alt+T on keyboard.

When it opens, run command to install the pipewire-audio-client-libraries package:

sudo apt install pipewire-audio-client-libraries 

If you installed Pipewire from this Ubuntu PPA, SKIP step 2.) and 3.) as they are already there! As well daemon-reload is not required.

2.) Then create an empty file by running command:

sudo touch /etc/pipewire/media-session.d/with-pulseaudio

3.) Create pipewire-pulse service files by copying the example files:

sudo cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /etc/systemd/user/

4.) You don’t have to remove the PulseAudio, just disable it and enable Pipewire:

  • Run command to reload the new service files:
    systemctl --user daemon-reload
  • Disable PulseAudio service via command:
    systemctl --user --now disable pulseaudio.service pulseaudio.socket
  • And finally enable the Pipewire services:
    systemctl --user --now enable pipewire pipewire-pulse

5.) I followed the previous steps via Debian Wiki, but it didn’t work. The system tray sound icon’s gone, and pactl info outputs “Connection failure: Connection refused”.

To workaround the issue, enable pipewire-media-session service may work by running command:

systemctl --user --now enable pipewire-media-session.service

If you’re trying to get it work in Ubuntu 20.04, try “mask” the PulseAudio service before reboot, by running command:

systemctl --user mask pulseaudio

Finally reboot your machine.

And check if Pipewire is working, run pactl info command. And it’s working if you see “PulseAudio (on PipeWire 0.3.24)” in output.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected]

8 responses to How to Enable PipeWire Audio Service to Replace PulseAudio in Ubuntu 21.04

  1. Hi The PPA owner here. I think you need to improve this.
    The debian wiki is obsolete as this PPA walk you through in a straightforward way.

    1. Your 2 & 3 steps are obsolete, as I already did that at my end.
    2. At step 4 as the 3rd step is obsolete, No need to daemon-reload.
    3. Since PW 0.3.23, they included pipewire-media-session.service, so that must be enabled.
    4. No need to reboot.

    AND THE BIG THING IS FROM TODAY’S COMMIT, SUPPORT FOR UBUNTU 18.04 IS ADDED.

    The detailed installation instruction can be found at – https://pipewire-debian.github.io

  2. The copy command does not work:

    sudo cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /etc/systemd/user/
    [sudo] password for mosesask:
    cp: cannot stat ‘/usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.*’: No such file or directory

    • If you’ve added an Ubuntu PPA with updated PipeWire package, these service files should be already there. If so, simply skip this command since it was for stock PipeWire package.

  3. These steps don’t work on Ubuntu 21.04. Pipewire doesn’t start and on reboot its back to pulseaudio

    Steps tried: 1) 2) 3) 4) 5)

    Additionally, this is the error I get when trying pactl info:
    Connection failure: Connection refused
    pa_context_connect() failed: Connection refused

  4. Is there a way to configure this system-wide

  5. Thanks for the write-up. I had to add one thing to allow my bluetooth headset so work (from https://askubuntu.com/questions/1339765/replacing-pulseaudio-with-pipewire-in-ubuntu-20-04):

    sudo apt install libspa-0.2-bluetooth

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.