Enable PipeWire for Audio and Bluetooth in Ubuntu 22.04 or 20.04

We can use the commands given in this tutorial to configure our Ubuntu 22.04 or 20.04 to use PipeWire as an Audio server instead of the default PulseAudio.

PipeWire in Linux is a multimedia framework for Linux to handle audio and video streams with the help of API. The framework’s API can be used across various types of devices such as webcams, microphones, and audio/video playback devices. It can also handle low-latency audio and video streams, hence the users can use it for real-time apps. For example while gaming and video conferencing. To enhance security, PipeWire offers fine-grained access controls for devices. It was developed by Wim Taymans at Red Hat.

Enable PipeWire on Ubuntu to use instead of PulseAudio

Unlike Ubuntu 20.04, we don’t need to install PipWire on Ubuntu 22.04 Linux because it is already there on the system pre-installed. However, we just need to configure it to replace PluseAudio for our audio and Bluetooth devices.

For Ubuntu 20.04 only

The latest version of PipeWire and WirePlumber are not available by default on 20.04 Focal, therefore, we need to install them by adding a PPA repository. Also, users of Ubuntu 22.04 who want the latest version of this framework and sessions manager can also add the PPA, if they want.

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

Install PipeWire on Ubuntu 20.04

After adding the repository, run the system update command then use the APT to install the required packages:

sudo apt install pipewire pipewire-session-manager

Reload the daemon:

systemctl --user daemon-reload

Start the services:

systemctl --user --now enable pipewire pipewire-session-manager

Check PipeWire Service

First, let’s check the PipeWire is installed and running on our Ubuntu 22.04 or 20.04 without any errors. For that, in the command terminal run the following command:

systemctl status --user pipewire pipewire-session-manager --no-pager -l
Check pipewire session on Ubuntu 22.04 or 20.04

Install required PipeWire packages

Let’s install some extra packages that will support the PipeWire to use for audio or video output. Also, the given command will install codecs to support LDAC.

sudo apt install libldacbt-{abr,enc}2 libspa-0.2-bluetooth pipewire-audio-client-libraries libspa-0.2-jack

Use WirePlumber as the session manager (for Ubuntu 22.04 only)

Instead of using the Piperwire session manager, install WirePlumber, which is a more advanced and powerful session manager.

sudo apt install wireplumber

Output:

The following additional packages will be installed:
liblua5.3-0 libwireplumber-0.4-0 pipewire-pulse
The following packages will be REMOVED:
pipewire-media-session
The following NEW packages will be installed:
liblua5.3-0 libwireplumber-0.4-0 pipewire-pulse wireplumber
0 upgraded, 4 newly installed, 1 to remove and 89 not upgraded.
Need to get 452 kB of archives.
After this operation, 1,443 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

Install WirePlumber service

Start WirePlumber service on Ubuntu 22.04

By default the service of WirePlumber will not be running, therefore, we have to start and enable it to run with system boot. Here is the command to do that:

systemctl --user --now enable wireplumber.service
Start and enable wireplumber service ubuntu 22.04

Disable PulseAudio

Use the given commands to disable PulseAudio:

systemctl --user --now disable pulseaudio.{socket,service}
systemctl --user mask pulseaudio

Configure ALSA, Jack, and Bluetooth

You can use the one command to copy all required PipeWire configuration files to e

sudo cp -vRa /usr/share/pipewire /etc/

 Whereas:

For ALSA:

To configure ALSA – Advanced Linux Sound Architecture which is a software framework and a part of Linux Kernel, the job is to provide an API for sound card device drivers; to use PipeWirem, copy the default configuration file available in the PipeWire installation folder to ALSA.

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

For Bluetooth

To use it for Bluetooth, just run the given command that will remove the Bluetooth module of PulseAudio in favor of PipeWire.

sudo apt remove pulseaudio-module-bluetooth

For JACK:

To use PipeWire for JACK, a low-latency audio server API, copy the configuration file available for it in the PipeWire folder.

sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/

Reboot the system and verify the PipeWire

Once you have completed the commands given above restart your Ubuntu 22.04 or 20.04 system, once, to properly integrate PipeWire.

reboot

After rebooting, open the command terminal and run:

pactl info

The above command will offer you the details of the Audio server, go to the Server name line, and there you will see :

Server Name: PulseAudio (on PipeWire x.x.x)

Before and After results

Before rebooting:

Pulse Audo Server Details

After rebooting:

PulseAudio server on PipeWire

Disable PipeWire for PulseAudio (optional)

In the future, if you need to disable the PipeWire usage for PulseAudio, then that is possible as well without removing it. Here is the command:

First, we need to unmask the PusleAudio service otherwise we get an error while enabling it:

Error: Failed to enable unit: Unit file /home/h2s/.config/systemd/user/pulseaudio.service is masked.

Now, unmask it:

systemctl --user unmask pulseaudio

After that enable the service:

systemctl --user --now enable pulseaudio.{socket,service}

Now, reboot your system and check the server name by using the command:

pactl info

Other Articles:

3 thoughts on “Enable PipeWire for Audio and Bluetooth in Ubuntu 22.04 or 20.04”

  1. with
    sudo apt remove pulseaudio-module-bluetooth
    you should also remove bluez-alsa-utils
    sudo apt remove bluez-alsa-utils
    without this my pulseaudio could not see my bluetooth headset as output on ubuntu 22.04

    Reply
  2. Hi, thanks for the article
    I made all the required changes required for Ubuntu 22.04, including sudo apt remove bluez-alsa-utils, in order to fix my headset bluetooth MIC issue
    And I cannot connect to any bluetooth devices anymore

    service bluetooth status returns

    bluetooth.service – Bluetooth service
    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2023-06-19 10:54:36 CEST; 5min ago
    Docs: man:bluetoothd(8)
    Main PID: 1171 (bluetoothd)
    Status: “Running”
    Tasks: 1 (limit: 8718)
    Memory: 2.3M
    CPU: 354ms
    CGroup: /system.slice/bluetooth.service
    └─1171 /usr/lib/bluetooth/bluetoothd

    src/service.c:btd_service_connect() a2dp-sink profile connect failed for F4:BC:DA:FD:C3:C0: src/service.c:btd_service_connect() a2dp-source profile connect failed for F4:BC:DA:FD:C3:C0: Protocol not available

    Any idea?

    Reply

Leave a Comment

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