Skip to content

Instantly share code, notes, and snippets.

@the-spyke
Last active May 3, 2025 13:52
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'
@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 👍

@benduran
Copy link

benduran commented Nov 4, 2022

Worked great for me on 22.04 and unbroke my RME Fireface 802 from capturing multitrack input, thanks!

@jentur-zabbeJ-8basdy
Copy link

I have a pretty clean install.

The pipewire-pulse package does not replace pipewire-pulse though, or doesn't look like it's configured to:

~ apt show  pipewire-pulse
Package: pipewire-pulse
Version: 0.3.32-1
Priority: optional
Section: universe/video
Source: pipewire
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Utopia Maintenance Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 48.1 kB
Depends: pipewire (= 0.3.32-1), init-system-helpers (>= 1.52), libc6 (>= 2.4), libpipewire-0.3-0 (= 0.3.32-1)
Breaks: pipewire-bin (<< 0.3.27-2)
Replaces: pipewire-bin (<< 0.3.27-2)
Homepage: https://pipewire.org/
Download-Size: 8,324 B
APT-Sources: http://gb.archive.ubuntu.com/ubuntu impish/universe amd64 Packages
Description: PipeWire PulseAudio daemon
 PipeWire is a server and user space API to deal with multimedia
[...]

Copy that, thanks for the aclaration @aglasgall 👍

@jentur-zabbeJ-8basdy
Copy link

Worked great for me on 22.04 and unbroke my RME Fireface 802 from capturing multitrack input, thanks!

@jentur-zabbeJ-8basdy
Copy link

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

@jentur-zabbeJ-8basdy
Copy link

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

@CourtJester011
Copy link

Attempting to install pipewire using this method took out my GUI and I'm not exactly sure how to fix it. I ended up having to use timeshift to restore it.

@CourtJester011
Copy link

The second command gave me to following error message:

sudo apt install \
  libspa-0.2-bluetooth \
  pipewire-audio-client-libraries \
  pipewire-media-session- \
  wireplumber
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.48-1ubuntu1) but 0.3.48-1ubuntu2 is to be installed
 pipewire-audio-client-libraries : Depends: pipewire (= 0.3.48-1ubuntu1) but 0.3.48-1ubuntu2 is to be installed
                                   Depends: libpipewire-0.3-0 (= 0.3.48-1ubuntu1) but 0.3.48-1ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

Running apt list -a showed the following:

pipewire/now 0.3.48-1ubuntu2 amd64 [installed,local]
pipewire/jammy 0.3.48-1ubuntu1 amd64

pipewire/jammy 0.3.48-1ubuntu1 i386

sudo apt install pipewire/jammy and installing pipewire's needed packages and configurations seemed to work except it took out my GUI on reboot. I ultimately had to use timeshift to restore to a previous environment. Any ideas as to why this happened?

@the-spyke
Copy link
Author

@CourtJester011 pipewire/now 0.3.48-1ubuntu2 amd64 [installed,local] It says local,which means the package is not found in current repos. Please check that your apt sources are configured properly for jammy and you don't have another PPA interfering.

@CourtJester011
Copy link

CourtJester011 commented Dec 8, 2022

Wanted to follow up as I found how to resolve my above issue:
Had to check additional packages and install with the /jammy option as there were package conflicts. Installing pipewire/jammy removed a number of packages which ended up breaking my gdm3 GUI. Next time I ran sudo apt install pipewire/jammy, I copied the package list that was to be removed and did research on them. This is what followed:
gdm3 install gdm3/jammy
gnome-shell gnome-shell/jammy
gnome-shell-extension-appindicator Leave alone
gnome-shell-extension-desktop-icons-ng install the /jammy version
gnome-shell-extension-ubuntu-dock install the /jammy version
gstreamer1.0-pipewire install /jammy
ubuntu-desktop /leave alone
ubuntu-desktop-minimal leave alone
ubuntu-release-upgrader-gtk /jammy
ubuntu-session leave alone
update-manager leave alone
update-notifier leave alone
Command I ran is as follows:

sudo apt install \
pipewire/jammy \
gdm3/jammy \
gnome-shell/jammy \
gnome-shell-extension-desktop-icons-ng/jammy \
libspa-0.2-bluetooth \
pipewire-audio-client-libraries \
pipewire-media-session- \
wireplumber

This fixed my issue with GUI becoming broken and I was able to follow the rest of this guide successfully without breaking my GUI.

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