Skip to content

Instantly share code, notes, and snippets.

@the-spyke
Last active May 1, 2025 02:27
Show Gist options
  • Save the-spyke/2de98b22ff4f978ebf0650c90e82027e to your computer and use it in GitHub Desktop.
Save the-spyke/2de98b22ff4f978ebf0650c90e82027e to your computer and use it in GitHub Desktop.
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

Install

Install WirePlumber as the session manager:

$ sudo apt install pipewire-media-session- wireplumber

Notice '-' at the end of 'pipewire-media-session'. This is to remove it in the same command, because 'wireplumber' will be used instead.

Start WirePlumber for your user:

$ systemctl --user --now enable wireplumber.service

Configure

ALSA

Install the ALSA plug-in:

$ sudo apt install pipewire-audio-client-libraries

And copy the config file from PipeWire docs (provided by the plug-in) into the ALSA configuration directory:

$ sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/

Check if you have other (like Pulse) configs in the /etc/alsa/conf.d/ installed by something else. You might want to remove them.

PulseAudio

Everything was done automatically by pipewire-pulse package, which should have been installed by wireplumber package as recommended. If not, install it yourself.

Bluetooth

Install the codecs and remove Bluetooth from PulseAudio, so it would be handled directly by PipeWire:

$ sudo apt install libldacbt-{abr,enc}2 libspa-0.2-bluetooth pulseaudio-module-bluetooth-

The supported codecs are SBC and LDAC.

Unfortunately, aptX and AAC are not supported because of patents and other technical reasons. aptX is available starting from 22.10 via libfreeaptx0 installed by default there (22.10 uses PipeWire by default as well). If you really need these codecs in 22.04 you may use this PPA from @aglasgall which is based on universe, but rebuilds pipewire with additional packages for aptX and AAC from multiverse. Read the discussion here.

Done

Reboot and check if it works by running:

$ LANG=C pactl info | grep '^Server Name'
@the-spyke
Copy link
Author

@luispabon From the Debian wiki by the link in the gist:

PulseAudio
Install the pipewire-pulse package, and reboot. This will configure PipeWire to activate its PulseAudio replacement daemon. 

And it works fine. My output:

$ pactl info | grep '^Server Name' 
Server Name: PulseAudio (on PipeWire 0.3.32)

@luispabon
Copy link

Mm that's strange, the package installs fine on my system but does not seem to do that.

@vietcheems
Copy link

Worked fine until the bluetooth install. When i tried

sudo apt install libspa-0.2-bluetooth

i got this error

$ sudo apt install libspa-0.2-bluetooth
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libspa-0.2-bluetooth : Depends: libspa-0.2-modules (= 0.3.32-1) but 0.3.42.r46.g65aadeb-1~ubuntu21.10 is to be installed
E: Unable to correct problems, you have held broken packages.

@florentdestremau
Copy link

Same here, I keep getting the same error as the comment above, but nevertheless everything works fine

@lotusbun
Copy link

The same issue happens for me. I wonder if this package is why my bluetooth headset connects but has no audio sink

@luispabon
Copy link

If you mean this error:

Depends: libspa-0.2-modules (= 0.3.32-1) but 0.3.42.r46.g65aadeb-1~ubuntu21.10 

you need to look at potentially some PPA interfering. That at least works OK for me:
image

I still wasn't able to get pipewire-pulseaudio to start, given up until 22.04 comes about to see if a fresh lot of packages will make it run on my laptop.

@lotusbun
Copy link

lotusbun commented Feb 21, 2022

Thank you for pointing me to the possibility of PPA conflicts. I didn't find any particular conflicts on my 21.10 system, but I tried adding an upstream pipewire PPA like thus

sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream

and then also added its upstream wireplumber ppa,

ppa:pipewire-debian/pipewire-upstream

where I was then able to install the mentioned bluetooth module after updating the repos and upgrading any available upgrades. I have yet to figure out why my bluetooth headset does not have an audio sink, though; my system still outputs sound to the one available speaker output.

@cwagnersc
Copy link

Hi!
I tried what is here, but this (https://linuxconfig.org/how-to-install-pipewire-on-ubuntu-linux) helped a lot

@slyon
Copy link

slyon commented Apr 22, 2022

On Ubuntu Jammy 22.04 LTS I also had to sudo apt -y install wireplumber && systemctl --user enable --now wireplumber.service in order to make any audio devices show up. Before, it only showed a "Dummy output" and no sound.

(Wireplumber is a replacement for pipewire-media-sessions)

@the-spyke
Copy link
Author

@slyon Thank you. I will update this Gist after I switch to 22.04 (should happen in a week or two).

@jmayday
Copy link

jmayday commented Aug 1, 2022

On KDE neon I can't just install wireplumber:

➜  ~ sudo apt -y install wireplumber
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package wireplumber is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'wireplumber' has no installation candidate

@luispabon
Copy link

Wireplumber is on the universe repository for ubuntu 22.04 onwards. Neon must be behind.

@TID41
Copy link

TID41 commented Aug 1, 2022

Neon is still based on Ubuntu 20.04. This will probably change in the next month or so as it rebases to 22.04, but as of now (August 1 2022), it is still 20.04.

@mathiasfriman
Copy link

Hi! I tried what is here, but this (https://linuxconfig.org/how-to-install-pipewire-on-ubuntu-linux) helped a lot

This helped me as well. These instructions above didn't.

@the-spyke
Copy link
Author

This is instruction stands at the very top that it is made for the people, who want to avoid adding the PPA by that link. You fix one thing by installing from a PPA and now some other thing might stop working for some reason. So, choose what is more important to you.

@mathiasfriman
Copy link

This is instruction stands at the very top that it is made for the people, who want to avoid adding the PPA by that link.

What I'm trying to say is that the instructions at the very top didn't work (for me) when I tried them to the letter. So it needs to be updated or changed in some way. I wasn't in the mood for bug hunting, so I just followed the link, installed the PPA and it worked. I'm aware that introducing a PPA is not ideal and can be a source for errors down the line, but I just wanted to get going.

@luispabon
Copy link

luispabon commented Aug 8, 2022

Just to be clear for other people, if you're on Ubuntu 22.04 it's very unlikely you need the PPA. The pipewire packages are pretty recent and wireplumber is also available.

Likewise, Ubuntu 22.10 will already have pipewire by default instead of pulseaudio.

@slano
Copy link

slano commented Aug 8, 2022

I was able to set up pipewire on a fresh installation of Linux Mint Vanessa (based on Ubuntu 22.04) following the instructions provided by @the-spyke

@geloczi
Copy link

geloczi commented Aug 28, 2022

Worked like a charm on Kubuntu 22.04, thank you for the nice and clean documentation!

@nitturis
Copy link

WOW!!! it worked ..Thanks

@RafaelKa
Copy link

@the-spyke Thanks, it is very nice.

All works, except APT-X on Ubuntu 22.04.
Previously in 20.04 APT-X worked with EHfive/pulseaudio-modules-bt.

Does somebody know, why APT-X is not available for now(installed on 2022.09.14)?

@an4s911
Copy link

an4s911 commented Sep 18, 2022

How can I reproduce the same on another distro? Specifically Arch Linux?

@aglasgall
Copy link

aglasgall commented Sep 30, 2022

I had to grab the source package for pipewire, edit it, and and rebuild the package to get AAC and aptX support. You need to:

  • add libfdk-aac-dev to Build-Depends and remove Build-Conflicts: libfdk-aac-dev in debian/control
  • add libfreeaptx-dev to Build-Depends in debian/control
  • change disabled to enabled for both bluez5-codec-aac and bluez5-codec-aptx in override_dh_auto_configure in debian/rules
  • bump the package version in debian/changelog
  • sbuild it in an chroot that has universe and multiverse enabled
  • install the results

I can supply a debdiff (or, I suppose, a PPA containing the rebuilt pipewire packages) if that would be desirable.

@aglasgall
Copy link

I should note that I've only tested this with AAC; I don't have a headset that does LDAC or aptX. But the LDAC and aptX codec modules got installed and I expect that at least LDAC works as well as it does in the distribution package.

@aglasgall
Copy link

aglasgall commented Sep 30, 2022

I found myself with a little time on my hands, so I put up a PPA with the rebuilt pipewire packages: https://launchpad.net/~aglasgall/+archive/ubuntu/pipewire-extra-bt-codecs

Note that you will need to have the universe and multiverse repositories enabled to use these packages!

If all you want is LDAC, FastStream, and SBC(-XQ), you DO NOT NEED THIS PPA. The distribution packages already support these codecs! You only need to add this PPA if you want AAC and (probably) aptX support.

@the-spyke
Copy link
Author

@aglasgall Thank you for your help. Could you please post your findings and the solution to Launchpad, so this issue will be fixed in time for 22.10 release in one month?

@aglasgall
Copy link

aglasgall commented Sep 30, 2022

The solution is not one that Ubuntu upstream will take. libfdk-aac2 is in multiverse due to its license or general Intellectual Property situation and as such pipewire in main is not allowed to depend on it by policy.

@the-spyke
Copy link
Author

Oh, sorry, didn't think about that. Pity that it has to be a rebuild and not just a bunch of non-free plugins you can install additionally.

@aglasgall
Copy link

aglasgall commented Sep 30, 2022

It does appear that pipewire in kinetic builds with aptX support, so if that is all you care about 22.10 will fix your problem. AAC support will remain blocked by policy until Fraunhofer changes the copyright or patent situation that is responsible for libfdk-aac2 being in multiverse (or until any relevant patents expire)

@aglasgall
Copy link

It would certainly be technically possible to have a libspa0.2-bluetooth-nonfree that could live in multiverse in a future release, but it would require someone to actually break out the relevant code in pipewire into a separate source package and maintain that. I am explicitly not volunteering to do that :)

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