PipeWire: Difference between revisions

From Alpine Linux
m (fixup heading level)
m (restored back the prerequisite to original location)
 
(80 intermediate revisions by 17 users not shown)
Line 1: Line 1:
{{Draft|The instructions below have not been thoroughly tested and may break things.}}
{{TOC right}}
 
[https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux. Pipewire can act as a replacement for both [[PulseAudio]] and [[ALSA]] servers.
[https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux.


== Prerequisites ==
== Prerequisites ==


=== Audio Group ===
* PipeWire requires [[D-Bus#D-Bus session bus|D-Bus session bus]] for most of its functionality.
* If [[Elogind|elogind]] is used, no further configuration is required.
** If [[Elogind#Verify_working_of_elogind|elogind is not used]], the user [[Setting_up_a_new_user#Group_management|should be added]] to <code>audio</code> group to access audio devices.
** Add <code>video</code> group, if you need to access webcam devices. 
***{{Warning|Membership of the <code>video</code> group will also grant unrestricted access to video devices, which is often a security issue. See issue {{issue|15409}} for further details.}}


When elogind is not available, the user has to be added to the <code>audio</code> group. The user must log in for this to take effect.
== Installation ==


<pre>
The following packages i.e {{Pkg|pipewire}} and {{Pkg|wireplumber}} a session manager are the minimum required packages for getting pipewire to work.{{Cmd|# apk add pipewire wireplumber}}
# addgroup <user> audio
</pre>


=== D-Bus ===
=== Pulseaudio interface ===


PipeWire requires a running [https://www.freedesktop.org/wiki/Software/dbus/ D-Bus] session. If you use a full desktop environment this will probably be started automatically, but with minimal window managers it must be done manually.
The package {{Pkg|pipewire-pulse}} allows pulseaudio applications and [[#GUI tools|GUI tools]] to use PipeWire as audio server in the backend.{{Cmd|# apk add pipewire-pulse}}


<pre>
=== JACK compatibility ===
# apk add dbus dbus-openrc dbus-x11
# rc-service dbus start
# rc-update add dbus default
</pre>


Then use <code>dbus-launch</code> whenever you start an X or Wayland session. For example:
Since Pipewire replaces JACK, Install {{Pkg|pipewire-jack}} package, so it provides ABI-compatible libraries for JACK applications.{{Cmd|# apk add pipewire-jack}}
<pre>
$ dbus-launch --exit-with-session sway
</pre>


=== XDG_RUNTIME_DIR ===
=== ALSA support ===


If you are not using a Desktop Manager, ensure that your <code>XDG_RUNTIME_DIR</code> is set to a user-writable location. By default for pulseaudio this is {{Path|/run/user/1000/}} or {{Path|/tmp}}. If this is not set, pipewire will create a directory in your home folder instead, called <code>~/pulse</code>, and on attempting to run Pavucontrol or pactl, you will get the following error:
Install {{Pkg|pipewire-alsa}} package to provide support for Alsa applications.{{Cmd|# apk add pipewire-alsa}}


<pre>
=== GUI tools ===
$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
</pre>


== Installation and configuration ==
[[#Pulseaudio interface|Pulseaudio Interface]] is mandatory for {{ic|pavucontrol}} to work with PipeWire.


<pre>
<code>pavucontrol</code> tool from {{Pkg|pavucontrol}} provide a simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} for [[KDE|Plasma]], if not installed already.
# apk add pipewire wireplumber
</pre>


{{Note|Using [https://gitlab.freedesktop.org/pipewire/wireplumber WirePlumber] rather than the pipewire-media-session (which comes with pipewire) is [https://gitlab.freedesktop.org/pipewire/media-session/-/blob/master/README.md recommended] but not required.}}
The XFCE Audio mixer can also be used to help control volume by installing the package {{pkg|xfce4-mixer}} which is currently in available in [[Repositories#Testing|testing]] repository.


Create a custom configuration file in {{Path|/etc/pipewire/pipewire.conf}}:
''{{Pkg|qpwgraph}}''' is a graph manager dedicated to PipeWire with Qt GUI Interface.


<pre>
== Launch Pipewire  ==
# mkdir /etc/pipewire
# cp /usr/share/pipewire/pipewire.conf /etc/pipewire/
</pre>


Add the following line to the <code>context.exec</code> section at the bottom of {{Path|/etc/pipewire/pipewire.conf}}:
Most [[Desktop_environments_and_Window_managers#Desktop_environments|desktop environments]] launch Pipewire automatically in Alpine Linux upon relogging( i.e logging out and logging in) after [[#Installation|installing the above packages]]. Proceed with section below only if Pipewire is [[#Testing|not launched]] after a relogin/reboot.


<pre>
[[#Pipewire user service|Pipewire user service]] is the recommended method to launch Pipewire and will replace [[#pipewire-launcher|pipewire-launcher]]. Do '''NOT''' use both methods to avoid running multiple instances of Pipewire.
{ path = "wireplumber"  args = "" }
</pre>


Enable the <code>snd_seq</code> kernel module for ALSA support.
=== Pipewire user service ===


<pre>
Since [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|V3.22]], Pipewire can be launched as a user service. 
# modprobe snd_seq
# echo snd_seq >> /etc/modules
</pre>


=== Realtime scheduling ===
{{Note| Ensure the [[OpenRC#Prerequisites|Prerequisites]] are met and necessary [[OpenRC#Configure environment variables|environment variables are configured]] for using OpenRC user services before proceeding further.}}


For realtime scheduling, it is recommended to use rtkit,
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as '''gui''' and '''default''' for Wayland and Xorg, respectively, before proceeding.


To start the [[PipeWire]] user service and its '''wireplumber''' session manager:
<pre>
<pre>
# apk add rtkit
$ rc-service -U pipewire start
$ rc-service -U wireplumber start
</pre>
</pre>
 
To enable the [[PipeWire]] and '''wireplumber''' user services in '''Wayland''', issue the following commands;  omit the term {{ic|gui}}/swap it for {{ic|default}} for '''Xorg''' sessions:
and then add your user to the `rtkit` group.
 
Alternatively, ensure your user has the right ulimit permissions. You generally need (limits.conf format):
 
<pre>
<pre>
@audio - memlock 256
$ rc-update -U add pipewire gui
@audio - nice -11
$ rc-update -U add wireplumber gui
@audio - rtprio 88
</pre>
</pre>


This allows a member of the audio group to have the right permissions for PipeWire to use realtime scheduling without rtkit.
The above steps may be repeated for other user services, such as {{ic|pipewire-pulse}}, etc.  


=== ALSA ===
Note that the {{ic|pipewire-pulse}} service would be required to enable various functions, including setting audio levels with {{ic|pactl}} when [[PulseAudio#PulseAudio_Utils|running pulseaudio with pulseaudio-utils]] and to enable associated volume user keys.


<pre>
=== pipewire-launcher ===
# apk add pipewire-alsa
</pre>


ALSA support works out of the box if you have the pipewire-alsa package
{{Note|The pipewire-launcher script will be removed in the future to be replaced with [[#Pipewire user service|OpenRC User service]].}}


=== PulseAudio ===
Launch PipeWire by using the <code>pipewire-launcher</code> script. You'll probably get quite a few errors but just ignore them for now. {{Cmd|$ /usr/libexec/pipewire-launcher}}


PipeWire can run a [https://www.freedesktop.org/wiki/Software/PulseAudio/ PulseAudio] daemon which should allow all existing PulseAudio applications to be used with the PipeWire backend.
If .xinitrc is used, add {{Path|/usr/libexec/pipewire-launcher}} to your {{Path|~/.xinitrc}}.


<pre>
If you do not use GUI by default, add the following stanza to your shell configuration file:{{Cmd|export $(dbus-launch)
# apk add pipewire-pulse
/usr/libexec/pipewire-launcher}}
</pre>


Uncomment the following line in {{Path|/etc/pipewire/pipewire.conf}}:
== Configuration ==


<pre>
PipeWire and WirePlumber store their default configuration in {{Path|/usr/share/pipewire}} and {{Path|/usr/share/wireplumber}} respectively. If you want to edit the configuration, you need to move it to {{Path|/etc}}:
{ path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf" }
</pre>


It should be automatically enabled.
{{Cmd|<nowiki># cp -a /usr/share/pipewire /etc
# cp -a /usr/share/wireplumber /etc</nowiki>}}


=== JACK ===
=== Screen sharing on Wayland ===


If you will be using PipeWire for [https://jackaudio.org/ JACK] applications install the required package and make system wide links to the PipeWire replacement JACK libraries (I have not had success using <code>pw-jack</code>). You will not need to start a JACK server.
Applications which don't implement native Wayland screensharing rely on [https://github.com/flatpak/xdg-desktop-portal xdg-desktop-portal] plus the correct backend for your compositor. Screen sharing is known to work on:
* GNOME with <code>xdg-desktop-portal-gtk</code>
* KDE Plasma with <code>xdg-desktop-portal-kde</code> and Firefox
* Sway with <code>xdg-desktop-portal-wlr</code> and Firefox, see [[Sway]] for details


<pre>
=== Bluetooth audio ===
# apk add pipewire-jack
{{Main|Bluetooth}}
# ln -sf /usr/lib/pipewire-0.3/jack/libjackserver.so.0 /usr/lib/libjackserver.so.0
* Enable PulseAudio support as described above
# ln -sf /usr/lib/pipewire-0.3/jack/libjacknet.so.0 /usr/lib/libjacknet.so.0
* Install bluetooth service packages: <code>bluez bluez-openrc pipewire-spa-bluez</code>
# ln -sf /usr/lib/pipewire-0.3/jack/libjack.so.0 /usr/lib/libjack.so.0
* Optional: install GUI manager for bluetooth <code>blueman</code>
</pre>
* Enable and start bluetooth service: <code>rc-update add bluetooth; rc-service bluetooth start</code>
 
* Restart PipeWire
{{Note|These symlinks might be overwritten during updates.}}
* Use commandline program  <code>bluetoothctl</code> or GUI program <code>blueman-manager</code> to scan and pair bluetooth audio devices.
* Use pavucontrol to adjust volume and manually select high definition bluetooth codecs.


=== Video ===
=== Video ===
Line 127: Line 104:
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications.
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications.


=== Bluetooth headset ===
=== Realtime scheduling ===


Requires <code>pipewire-spa-bluez</code> package in addition to <code>pipewire-pulse</code> daemon to be installed.
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the <code>rtkit</code> group.


=== Automatic bluetooth profile selection ===
Alternatively, ensure your user has the right ulimit permissions. Since pipewire 0.3.66, you can add yourself to the <code>pipewire</code> group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):


To automatically switch between HSP/HFP and A2DP profiles when an input stream is detected, set the bluez5.autoswitch-profile property to true:
<pre>
<pre>
/etc/pipewire/media-session.d/bluez-monitor.conf
@pipewire - memlock 4194304
@pipewire - nice -19
@pipewire - rtprio 95
</pre>


...
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with pipewire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don't have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].
rules = [
 
    {
== Testing ==
        ...
        actions = {
            update-props = {
                ...
                bluez5.autoswitch-profile = true
...
</pre>


Use the <code>wpctl</code> utility from {{pkg|WirePlumber}} to test the working of pipewire: {{Cmd|$ wpctl status}}


=== pw-cat playback ===


=== Screen sharing on Wayland ===
Test sound is working using an audio file in a format supported by [http://www.mega-nerd.com/libsndfile/ libsndfile]{{insecure url|Server refuses HTTPS connections}} (e.g. flac, opus, ogg, wav). Use <code>pw-cat</code> utility from {{Pkg|pipewire-tools}}:


You will need the right [https://github.com/flatpak/xdg-desktop-portal xdg-desktop-portal] backend for your desktop environment. Screen sharing is known to work on:
{{Cmd|$ pw-cat -p test.flac
* GNOME with <code>xdg-desktop-portal-gtk</code>
$ pw-play /usr/share/sounds/alsa/Front_Center.wav
* KDE Plasma with <code>xdg-desktop-portal-kde</code> and Firefox
}}
* Sway with <code>xdg-desktop-portal-wlr</code> and Firefox


== Usage ==
=== pw-cat recording ===


Start the PipeWire media server. You'll probably get quite a few errors but just ignore them for now.
If you have a microphone test audio recording is working.


<pre>
{{Cmd|$ pw-cat -r --list-targets
$ pipewire
$ pw-cat -r recording.flac
</pre>
(Speak for a while then stop it with Ctrl+c)
$ pw-cat -p recording.flac
}}
 
=== PulseAudio ===


{{Note| PipeWire doesn't auto-start a session manager anymore.
Test PulseAudio clients using a media player, as most use PulseAudio.
In 3.14 and earlier, the PipeWire default config was edited in packaging to auto-start pipewire-media-session as the default session manager. Since we now have wireplumber available as an alternative session manager, this has been changed in favor of a launch wrapper for pipewire at /usr/libexec/pipewire-launcher. When executed, this will launch pipewire, pipewire-media-session or wireplumber, and pipewire-pulse, depending on what modules are available. If you were launching /usr/bin/pipewire and the session manager manually before, please use the new launcher wrapper instead. WirePlumber can now also be used as a proper alternative for pipewire-media-session.}}


In a different terminal window check the default output device. I don't yet know how this default can be changed for all applications, so you'd better hope it's right!
=== JACK ===


<pre>
Use <code>jack_simple_client</code> from {{Pkg|jack-simple-clients}}:
# apk add pipewire-tools
 
$ pw-cat -p --list-targets
{{Cmd|$ jack_simple_client}}
</pre>


Test sound is working using an audio file in a format supported by [http://www.mega-nerd.com/libsndfile/ libsndfile] (e.g. flac, opus, ogg, wav).
You should hear a sustained beep.


<pre>
== Troubleshooting ==
$ pw-cat -p test.flac
</pre>


If you have a microphone test audio recording is working.
=== `wpctl status` shows no targets ===


<pre>
First, check whether ALSA knows about your sound card using the <code>aplay</code> utility from {{pkg|alsa-utils}} package: {{Cmd|aplay -l}}
$ pw-cat -r --list-targets
$ pw-cat -r recording.flac
(Speak for a while then stop it with Ctrl+c)
$ pw-cat -p recording.flac
</pre>


Test PulseAudio clients using a media player (most use PulseAudio) and if you use JACK test that too:
If sound devices are found, the issue is with your pipewire configuration.  Consider double-checking the instructions above. Otherwise, your sound card may not be supported in the version of the Linux Kernel you're running.  You should search online for fixes relating to your current kernel version and the codec of your sound card.  You can find each of these with:


<pre>
{{Cmd|uname -r
# apk add jack-example-clients
cat /proc/asound/card0/codec* | grep Codec}}
$ jack_simple_client
</pre>


You should hear a sustained beep.
Modern devices might require {{Pkg|sof-firmware}}, which is the case if you get <code>sof firmware file is missing</code> errors in dmesg.


If you are happy everything is working, make PipeWire start automatically when your X or Wayland session starts. For example, you could add the <code>pipewire</code> command to <code>~/.xinitrc</code> or your window manager's config file.
=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY ===


== Troubleshooting ==
Check and ensure that [[D-Bus#D-Bus session bus|D-Bus session bus]] is started along with your GUI session i.e. you are in a tty.


=== `pw-cat -p --list-targets` shows no targets ===
=== Connection failure: Connection refused ===


First, check whether ALSA knows about your sound card:
When using [[Wayland]], ensure that [[XDG_RUNTIME_DIR]] is configured correctly. If this is not set, pipewire will create a directory in your home folder instead, called {{Path|~/pulse}}, and on attempting to run Pavucontrol or pactl, you will get the following error:


<pre>
<pre>
aplay -l
$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
</pre>
</pre>


If sound devices are found, the issue is with your pipewire configuration.  Consider double-checking the instructions above.
=== Bluetooth connect failed: br-connection-profile-unavailable ===
 
Ensure that [[#WirePlumber|Session Manager]] is running.


Otherwise, your sound card may not be supported in the version of the Linux Kernel you're running.  You should search online for fixes relating to your current kernel version and the codec of your sound card.  You can find each of these with:
=== Play/Pause buttons not working on bluetooth headphones ===


Check {{Path|/var/log/messages}}. If you see something like this:
<pre>
<pre>
uname -r
bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can't open input device: No such file or directory (2)
cat /proc/asound/card0/codec* | grep Codec
bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5
</pre>
</pre>


== Quick Configuration ==
Then bluez is trying to register the headphones buttons as an input devices, but <code>uinput</code> is not loaded. Try <code>modprobe uinput</code>. If this works, see [[Architecture#Module_Loading]] for instructions on how to make sure this module is loaded automatically on each startup.
 
=== RTKit error: org.freedesktop.DBus.Error.ServiceUnknown ===


You might want to use pavucontrol to have a simple GUI app for controlling sound, outputs, etc, in which case:
<pre>
<pre>
# apk add pavucontrol
mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:995:do_rtkit_setup: RTKit does not give us MaxRealtimePriority, using 1
mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:1000:do_rtkit_setup: RTKit does not give us MinNiceLevel, using 0
mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:1005:do_rtkit_setup: RTKit does not give us RTTimeUSecMax, using -1
</pre>
</pre>


== See Also ==
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.
 
== See also ==


* [[Bluetooth]]
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]
Line 234: Line 214:
* [https://wiki.gentoo.org/wiki/Pipewire PipeWire on the Gentoo Wiki]
* [https://wiki.gentoo.org/wiki/Pipewire PipeWire on the Gentoo Wiki]


[[Category:Multimedia]]
[[Category:Sound]]

Latest revision as of 04:25, 10 October 2025

PipeWire is a multimedia processing engine that aims to improve audio and video handling on Linux. Pipewire can act as a replacement for both PulseAudio and ALSA servers.

Prerequisites

  • PipeWire requires D-Bus session bus for most of its functionality.
  • If elogind is used, no further configuration is required.
    • If elogind is not used, the user should be added to audio group to access audio devices.
    • Add video group, if you need to access webcam devices.
      • Warning: Membership of the video group will also grant unrestricted access to video devices, which is often a security issue. See issue #15409 for further details.

Installation

The following packages i.e pipewire and wireplumber a session manager are the minimum required packages for getting pipewire to work.

# apk add pipewire wireplumber

Pulseaudio interface

The package pipewire-pulse allows pulseaudio applications and GUI tools to use PipeWire as audio server in the backend.

# apk add pipewire-pulse

JACK compatibility

Since Pipewire replaces JACK, Install pipewire-jack package, so it provides ABI-compatible libraries for JACK applications.

# apk add pipewire-jack

ALSA support

Install pipewire-alsa package to provide support for Alsa applications.

# apk add pipewire-alsa

GUI tools

Pulseaudio Interface is mandatory for pavucontrol to work with PipeWire.

pavucontrol tool from pavucontrol provide a simple GUI app for controlling sound, outputs, etc. Consider using pavucontrol-qt for Plasma, if not installed already.

The XFCE Audio mixer can also be used to help control volume by installing the package xfce4-mixer which is currently in available in testing repository.

qpwgraph' is a graph manager dedicated to PipeWire with Qt GUI Interface.

Launch Pipewire

Most desktop environments launch Pipewire automatically in Alpine Linux upon relogging( i.e logging out and logging in) after installing the above packages. Proceed with section below only if Pipewire is not launched after a relogin/reboot.

Pipewire user service is the recommended method to launch Pipewire and will replace pipewire-launcher. Do NOT use both methods to avoid running multiple instances of Pipewire.

Pipewire user service

Since V3.22, Pipewire can be launched as a user service.

Note: Ensure the Prerequisites are met and necessary environment variables are configured for using OpenRC user services before proceeding further.

Issue the command $ rc-status -Ur to view and verify the current user runlevel as gui and default for Wayland and Xorg, respectively, before proceeding.

To start the PipeWire user service and its wireplumber session manager:

$ rc-service -U pipewire start
$ rc-service -U wireplumber start

To enable the PipeWire and wireplumber user services in Wayland, issue the following commands; omit the term gui/swap it for default for Xorg sessions:

$ rc-update -U add pipewire gui
$ rc-update -U add wireplumber gui

The above steps may be repeated for other user services, such as pipewire-pulse, etc.

Note that the pipewire-pulse service would be required to enable various functions, including setting audio levels with pactl when running pulseaudio with pulseaudio-utils and to enable associated volume user keys.

pipewire-launcher

Note: The pipewire-launcher script will be removed in the future to be replaced with OpenRC User service.

Launch PipeWire by using the pipewire-launcher script. You'll probably get quite a few errors but just ignore them for now.

$ /usr/libexec/pipewire-launcher

If .xinitrc is used, add /usr/libexec/pipewire-launcher to your ~/.xinitrc.

If you do not use GUI by default, add the following stanza to your shell configuration file:

export $(dbus-launch) /usr/libexec/pipewire-launcher

Configuration

PipeWire and WirePlumber store their default configuration in /usr/share/pipewire and /usr/share/wireplumber respectively. If you want to edit the configuration, you need to move it to /etc:

# cp -a /usr/share/pipewire /etc # cp -a /usr/share/wireplumber /etc

Screen sharing on Wayland

Applications which don't implement native Wayland screensharing rely on xdg-desktop-portal plus the correct backend for your compositor. Screen sharing is known to work on:

  • GNOME with xdg-desktop-portal-gtk
  • KDE Plasma with xdg-desktop-portal-kde and Firefox
  • Sway with xdg-desktop-portal-wlr and Firefox, see Sway for details

Bluetooth audio

  • Enable PulseAudio support as described above
  • Install bluetooth service packages: bluez bluez-openrc pipewire-spa-bluez
  • Optional: install GUI manager for bluetooth blueman
  • Enable and start bluetooth service: rc-update add bluetooth; rc-service bluetooth start
  • Restart PipeWire
  • Use commandline program bluetoothctl or GUI program blueman-manager to scan and pair bluetooth audio devices.
  • Use pavucontrol to adjust volume and manually select high definition bluetooth codecs.

Video

Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and GStreamer applications.

Realtime scheduling

For realtime scheduling, it is recommended to use rtkit package. Add your user to the rtkit group.

Alternatively, ensure your user has the right ulimit permissions. Since pipewire 0.3.66, you can add yourself to the pipewire group. You generally need (e.g. in /etc/security/limits.conf):

@pipewire - memlock 4194304
@pipewire - nice -19
@pipewire - rtprio 95

This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with pipewire since 0.3.66, so if you have a PAM login session and add yourself to the pipewire group, you don't have to do anything else. Note that the above /etc/security/limits.conf will only work if your session is using PAM.

Testing

Use the wpctl utility from WirePlumber to test the working of pipewire:

$ wpctl status

pw-cat playback

Test sound is working using an audio file in a format supported by libsndfile 🔓 (e.g. flac, opus, ogg, wav). Use pw-cat utility from pipewire-tools:

$ pw-cat -p test.flac $ pw-play /usr/share/sounds/alsa/Front_Center.wav

pw-cat recording

If you have a microphone test audio recording is working.

$ pw-cat -r --list-targets $ pw-cat -r recording.flac (Speak for a while then stop it with Ctrl+c) $ pw-cat -p recording.flac

PulseAudio

Test PulseAudio clients using a media player, as most use PulseAudio.

JACK

Use jack_simple_client from jack-simple-clients:

$ jack_simple_client

You should hear a sustained beep.

Troubleshooting

`wpctl status` shows no targets

First, check whether ALSA knows about your sound card using the aplay utility from alsa-utils package:

aplay -l

If sound devices are found, the issue is with your pipewire configuration. Consider double-checking the instructions above. Otherwise, your sound card may not be supported in the version of the Linux Kernel you're running. You should search online for fixes relating to your current kernel version and the codec of your sound card. You can find each of these with:

uname -r cat /proc/asound/card0/codec*

Modern devices might require sof-firmware, which is the case if you get sof firmware file is missing errors in dmesg.

Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY

Check and ensure that D-Bus session bus is started along with your GUI session i.e. you are in a tty.

Connection failure: Connection refused

When using Wayland, ensure that XDG_RUNTIME_DIR is configured correctly. If this is not set, pipewire will create a directory in your home folder instead, called ~/pulse, and on attempting to run Pavucontrol or pactl, you will get the following error:

$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused

Bluetooth connect failed: br-connection-profile-unavailable

Ensure that Session Manager is running.

Play/Pause buttons not working on bluetooth headphones

Check /var/log/messages. If you see something like this:

bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can't open input device: No such file or directory (2)
bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5

Then bluez is trying to register the headphones buttons as an input devices, but uinput is not loaded. Try modprobe uinput. If this works, see Architecture#Module_Loading for instructions on how to make sure this module is loaded automatically on each startup.

RTKit error: org.freedesktop.DBus.Error.ServiceUnknown

mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:995:do_rtkit_setup: RTKit does not give us MaxRealtimePriority, using 1
mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:1000:do_rtkit_setup: RTKit does not give us MinNiceLevel, using 0
mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
mod.rt ../src/modules/module-rt.c:1005:do_rtkit_setup: RTKit does not give us RTTimeUSecMax, using -1

Installing the rtkit package as mentioned in Realtime scheduling section resolves the above error message.

See also