Skip to content

Instantly share code, notes, and snippets.

@the-spyke
Last active May 2, 2025 23:54
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

@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 :)

@the-spyke
Copy link
Author

For me personally AAC is more important because I have Apple AirPods, but for majority of users aptX should be preferable. So, I glad to hear that it is included in 22.10. Thank you for explaining all this. Maintaining parts of PipeWire is definitely out of question ๐Ÿ˜„

@aglasgall
Copy link

Anyway, go ahead and add the PPA to your instructions if you feel like it. Kinetic will be out soon and we can do the whole thing over again then.

@the-spyke
Copy link
Author

Will do. I guess I should also remove libfdk-aac2 and libopenaptx0 from the instructions as these codecs don't work.

@aglasgall
Copy link

aglasgall commented Sep 30, 2022

If you use my PPA, they'll get pulled in as dependencies.of libspa-0.2-bluetooth, yeah.

(also the actual library that gets used is freeaptx (libfreeaptx0), not libopenaptx0)

@vrossum
Copy link

vrossum commented Oct 6, 2022

This might help when bluetooth connects but has no audio (see bluez/bluez#157)

sudo systemctl stop bluetooth
rm -rf /var/lib/bluetooth ## clear any profiles
sudo systemctl start bluetooth

@aglasgall
Copy link

FYI I've applied the same change to pipewire 0.3.58 for kinetic (22.10) and uploaded it to the same PPA.

@luispabon
Copy link

There's no need for ppas anymore on 22.10, it already comes with pipewire instead of pulse

@aglasgall
Copy link

@luispabon The PipeWire in 22.04 and 22.10 both has aptX and AAC disabled at compile time, because the relevant libraries needed for those codecs are in 'universe' or 'multiverse' and it is Ubuntu project policy that packages in 'main' cannot depend on packages in 'universe' or 'multiverse'. My PPA has the jammy and kinetic pipewire packages rebuilt with aptX and AAC enabled.

It is true that you do not need a PPA to use pipewire as your audio server on either jammy or kinetic. But if you want the extra codecs, you need to either patch the packaging and rebuild yourself or use my PPA :)

@luispabon
Copy link

luispabon commented Oct 25, 2022

Copy that, thanks for the aclaration @aglasgall ๐Ÿ‘

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