PipeWire: Difference between revisions

From Alpine Linux
(clarify to dbus-run-session)
 
(71 intermediate revisions by 12 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 ==
 
* PipeWire requires [[D-Bus#D-Bus_session_bus|D-Bus session bus]] for most of its functionality.
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has appropriate [[Setting_up_a_new_user#Groups_for_desktop_usage|groups for desktop usage]].
* WirePlumber requires [[eudev]] for ALSA device discovery.
 
== Installation ==
 
Install {{Pkg|pipewire}} and {{Pkg|wireplumber}} (session manager).
 
{{Cmd|# apk add pipewire wireplumber}}
 
=== Pulseaudio interface ===


== Prerequisites ==
The package {{Pkg|pipewire-pulse}} allows pulseaudio applications and [[#GUI_tools|GUI tools]] to use PipeWire as audio server in the backend.


=== Device access ===
{{Cmd|# apk add pipewire-pulse}}


PipeWire needs proper permissions to access devices. If you do not use [[Elogind|elogind]], your user should be in <code>audio</code> and <code>video</code> groups:
=== JACK compatibility ===


<pre>
Since PipeWire replaces JACK, Install {{Pkg|pipewire-jack}} package, so it provides ABI-compatible libraries for JACK applications.
# addgroup <user> audio
# addgroup <user> video
</pre>


Make sure to re-login for these changes to take effect.
{{Cmd|# apk add pipewire-jack}}


=== D-Bus ===
=== ALSA support ===


PipeWire optionally requires a running [[D-Bus]] system and/or session bus for some of its functionality.
Install {{Pkg|pipewire-alsa}} package to provide support for ALSA applications.


For certain configurations (e.g. only audio playback and recording) D-Bus setup is not necessary. Edit [[#Disable_D-Bus_support|configuration files]] to disable D-Bus support.
{{Cmd|# apk add pipewire-alsa}}


You can start a dbus session like this: <code>dbus-run-session -- sh</code>(replacing sh with your shell or a window manager), or, <code>export $(dbus-launch)</code>. This is distinct from running dbus system-wide: <code>rc-service dbus start</code>, which is a prerequisite to run a user dbus session.
=== GUI tools ===


If you start session-wide dbus instance, make sure to start PipeWire in that same session.
* {{Pkg|pavucontrol}}: simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} when using [[KDE|Plasma]].  


=== XDG_RUNTIME_DIR ===
: [[#Pulseaudio_interface|Pulseaudio interface]] is mandatory for {{Ic|pavucontrol}} to work with PipeWire.


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:
* {{Pkg|xfce4-mixer}}: XFCE Audio mixer.


<pre>
: Currently available in the [[Repositories#Testing|testing]] repository.
$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
</pre>


Under [[Sway]], in order for <code>xdg-desktop-portal-wlr</code> to work it may also be necessary to set <code>XDG_CURRENT_DESKTOP</code> and <code>XDG_SESSION_DESKTOP</code> to <code>sway</code>
* {{Pkg|qpwgraph}}: graph manager dedicated to PipeWire with Qt GUI Interface.


== Installation ==
== Launch PipeWire ==


Install the {{Pkg|pipewire}} package.
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 the section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.


=== Session Manager ===
{{Note|[[#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.}}
PipeWire delegates plumbing work to session manager. There are two options available:
* '''[https://gitlab.freedesktop.org/pipewire/wireplumber WirePlumber]'''. It has modular design and supports Lua plugins. '''This is the recommended session manager. If you do not know which session manager you need, use WirePlumber.'''<br/>Package: {{Pkg|wireplumber}}
* '''[https://gitlab.freedesktop.org/pipewire/media-session pipewire-media-session]'''. It is much more simpler and covers only basic use cases. It was used for testing purposes. Now it does not make much sense since WirePlumber is available.<br/>Package: {{Pkg|pipewire-media-session}}


{{Note|This page assumes that you are using WirePlumber.}}
=== PipeWire user service ===


=== PulseAudio compatibility ===
Since [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|Alpine 3.22]], PipeWire can be launched as a user service.
Install {{Pkg|pipewire-pulse}} package, which provides a daemon so PulseAudio applications could use PipeWire as backend.


=== JACK compatibility ===
==== User service prerequisites ====
Install {{Pkg|pipewire-jack}} package, which provides ABI-compatible libraries for JACK applications.


=== ALSA support ===
* Ensure the [[OpenRC#Prerequisites|OpenRC User service Prerequisites]] are met and [[OpenRC#Configure environment variables|environment variables are configured]].
Install {{Pkg|pipewire-alsa}} package.
* Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as '''gui''' and '''default''' for Wayland and Xorg respectively.


== Configuration ==
==== User service management ====
PipeWire and WirePlumber store their default configuration in <code>/usr/share/pipewire</code> and <code>/usr/share/wireplumber</code> respectively. If you want to edit the configuration, you need to move it to <code>/etc</code>:


<pre>
To start the {{Ic|pipewire}} user service and its {{Ic|wireplumber}} session manager:
# cp -a /usr/share/pipewire /etc
# cp -a /usr/share/wireplumber /etc
</pre>


=== Disable D-Bus support ===
{{Cmd|$ rc-service -U pipewire start
Edit the following configuration parameters:
$ rc-service -U wireplumber start}}


''/etc/pipewire/pipewire.conf''
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], in [[Xorg]] change {{Ic|gui}} to {{Ic|default}}:
<pre>
context.properties = {
    ...
    support.dbus = false
}
</pre>


''/etc/wireplumber/wireplumber.conf''
{{Cmd|$ rc-update -U add pipewire gui
<pre>
$ rc-update -U add wireplumber gui}}
context.properties = {
    ...
    support.dbus = false
}
</pre>


''/etc/wireplumber/bluetooth.lua.d/50-bluez-config.lua''
The above steps may be repeated for {{Ic|pipewire-pulse}} user service.
<pre>
bluez_monitor.properties = {
  ...
  ["with-logind"] = false,
}
</pre>


''/etc/wireplumber/main.lua.d/50-alsa-config.lua''
{{Note|The {{ic|pipewire-pulse}} user 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>
alsa_monitor.properties = {
  ...
  ["alsa.reserve"] = false,
}
</pre>


''/etc/wireplumber/main.lua.d/50-default-access-config.lua''
=== pipewire-launcher ===
<pre>
default_access.properties = {
  ...
  ["enable-flatpak-portal"] = false,
}
</pre>
=== Realtime scheduling ===


For realtime scheduling, it is recommended to use {{Pkg|rtkit}}. Add your user to the <code>rtkit</code> group.
{{Note|The {{Ic|pipewire-launcher}} script will be removed in the future to be replaced with the [[#PipeWire_user_service|PipeWire user service]].}}


Alternatively, ensure your user has the right ulimit permissions. You generally need (e.g. in /etc/security/limits.conf):
Launch PipeWire by using the <code>pipewire-launcher</code> script. You'll probably get quite a few errors but just ignore them for now.


<pre>
{{Cmd|$ /usr/libexec/pipewire-launcher}}
@audio - memlock 256
@audio - nice -11
@audio - rtprio 88
</pre>


This allows a member of the audio group to have the right permissions for PipeWire to use realtime scheduling without rtkit.
If xinitrc is used, add {{Path|/usr/libexec/pipewire-launcher}} to your {{Path|~/.xinitrc}}.


Note that the above limits.conf will only work if your session is using [[PAM]].
If you do not use GUI by default, add the following stanza to your shell configuration file:


=== Video ===
{{Cmd|export $(dbus-launch)
/usr/libexec/pipewire-launcher}}


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


=== Bluetooth audio ===
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}}:


* Enable PulseAudio support as described above
{{Cmd|<nowiki># cp -a /usr/share/pipewire /etc
* Install bluetooth service packages: <code>bluez bluez-openrc pipewire-spa-bluez</code>
# cp -a /usr/share/wireplumber /etc</nowiki>}}
* Optional: install GUI manager for bluetooth <code>blueman</code>
* Enable and start bluetooth service: <code>rc-update add bluetooth; rc-service bluetooth start</code>
* Restart PipeWire
* 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.


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


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:
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>
* GNOME with <code>xdg-desktop-portal-gtk</code>
* KDE Plasma with <code>xdg-desktop-portal-kde</code> and Firefox
* 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
* Sway with <code>xdg-desktop-portal-wlr</code> and Firefox, see [[Sway]] for details


== Running ==
=== Bluetooth audio ===
{{Main|Bluetooth}}
* Enable PulseAudio support as described above
* Install bluetooth service packages: <code>bluez bluez-openrc pipewire-spa-bluez</code>
* Optional: install GUI manager for bluetooth <code>blueman</code>
* Enable and start bluetooth service: <code>rc-update add bluetooth; rc-service bluetooth start</code>
* Restart PipeWire
* 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.


{{Tip|You can also use <code>superd</code> to manage <code>pipewire</code> and its related services.}}
=== Video ===


{{Note|<code>pipewire-launcher</code> script is provided by Alpine Linux, not by upstream. Please report issues to Alpine Linux maintainers first.}}
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications.


Start the PipeWire media server. You'll probably get quite a few errors but just ignore them for now.
=== Realtime scheduling ===


<pre>
Realtime scheduling will increase certain threads priorities to assist with low latency audio processing.  By default, PipeWire tries to enable realtime scheduling with the [https://docs.pipewire.org/page_module_rt.html rt module].
$ /usr/libexec/pipewire-launcher
</pre>


If you do not have D-Bus session bus running (e.g. you are in tty or you are using minimalistic DE or window manager which does not launch D-Bus session) and you did not disable D-Bus in PipeWire configuration, use <code>dbus-launch</code>:
Since [https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.66 PipeWire 0.3.66], when you have a [[PAM]] login session, you should add your user to the {{Ic|pipewire}} group.


<pre>
The default system wide settings are defined in {{Path|/etc/security/limits.d/25-pw-rlimits.conf}}. You may want to adjust settings for parameters like <var>rt.prio</var>, if required. Alternatively, it can be set at [https://docs.pipewire.org/page_module_rt.html  user level] within the ceiling set by the system's rlimits.
$ dbus-launch /usr/libexec/pipewire-launcher
</pre>


{{Note| PipeWire doesn't auto-start a session manager anymore.
{{Cat|~/.config/pipewire/pipewire.conf.d/my-rt-args.conf|<nowiki>context.modules = [
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.}}
{  name = libpipewire-module-rt
 
    args = {
=== Auto launching ===
        #nice.level  = 20
You can add <code>/usr/libexec/pipewire-launcher</code> to your <code>.xinitrc</code>.
        #rt.prio      = 88
    }
    flags = [ ifexists nofail ]
}
]</nowiki>}}


If you do not use GUI by default and have D-Bus enabled in configuration, add the following stanza to your shell configuration file:
If you don't have [[PAM]] but [[D-Bus]] is available, the rt module will try to use {{Pkg|rtkit}}; if this is the case, add your user to the {{Ic|rtkit}} group.
<pre>
export $(dbus-launch)
/usr/libexec/pipewire-launcher
</pre>


== Testing ==
== Testing ==


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!
Use the <code>wpctl</code> utility from {{Pkg|wireplumber}} to test the working of PipeWire:


=== WirePlumber ===
{{Cmd|$ wpctl status}}
<pre>
$ wpctl status
</pre>


=== pw-cat playback ===
=== pw-cat playback ===


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). Use <code>pw-cat</code> utility from {{Pkg|pipewire-tools}}:
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}}:


<pre>
{{Cmd|$ pw-cat -p test.flac
$ pw-cat -p test.flac
$ pw-play /usr/share/sounds/alsa/Front_Center.wav
</pre>
}}


=== pw-cat recording ===
=== pw-cat recording ===
If you have a microphone test audio recording is working.
If you have a microphone test audio recording is working.


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


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


=== JACK ===
=== JACK ===
Use <code>jack_simple_client</code> from {{Pkg|jack-simple-clients}}:
Use <code>jack_simple_client</code> from {{Pkg|jack-simple-clients}}:


<pre>
{{Cmd|$ jack_simple_client}}
$ jack_simple_client
</pre>


You should hear a sustained beep.
You should hear a sustained beep.
Line 218: Line 178:
=== `wpctl status` shows no targets ===
=== `wpctl status` shows no targets ===


First, check whether ALSA knows about your sound card:
First, check whether ALSA knows about your sound card using the <code>aplay</code> utility from {{pkg|alsa-utils}} package:


<pre>
{{Cmd|$ aplay -l}}
aplay -l
</pre>


If sound devices are found, the issue is with your pipewire configuration.  Consider double-checking the instructions above.
If sound devices are found, the issue is likely with your PipeWire configuration.  Ensure that [[eudev]] is installed, and 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:
If no sound devices are found, 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
uname -r
$ cat /proc/asound/card0/codec* {{!}} grep Codec}}
cat /proc/asound/card0/codec* | grep Codec
 
</pre>
Modern devices might require {{Pkg|sof-firmware}}, which is the case if you get <code>sof firmware file is missing</code> errors in dmesg.


=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY ===
=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY ===
This means D-Bus session bus is not started and GUI is not active (i.e. you are in a tty). Use <code>dbus-launch</code> as outlined [[#Running|above]]. Alternatively, [[#D-Bus|disable D-Bus support]].
 
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.
 
=== Connection failure: Connection refused ===
 
When using [[Wayland]], ensure that [[Wayland#XDG_RUNTIME_DIR|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 {{Ic|pavucontrol}} or {{Ic|pactl}}, you will get the following error:
 
{{Cmd|$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused}}
 
If you are running Alpine 3.22+ and continue to experience this error after verifying that [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] is correctly set, ensure that the <code>pipewire-pulse</code> [[#PipeWire_user_service|user service is running]].


=== Bluetooth connect failed: br-connection-profile-unavailable ===  
=== Bluetooth connect failed: br-connection-profile-unavailable ===  


Ensure that a [[#Session_Manager|Session Manager]] is running.
Ensure {{Ic|wireplumber}}, the session manager, is running.


=== Play/Pause buttons not working on bluetooth headphones ===
=== Play/Pause buttons not working on bluetooth headphones ===


Check <code>/var/log/messages</code>. If you see something like this:
Check {{Path|/var/log/messages}} for lines similar to:
 
{{Cat|/var/log/messages|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}}


<pre>
Then {{Ic|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#Loading_of_Kernel_Modules|Loading of Kernel Modules]] for instructions on how to make sure this module is loaded automatically on each startup.
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
</pre>


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 ===


== Quick Configuration ==
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


You might want to use {{Pkg|pavucontrol}} to have a simple GUI app for controlling sound, outputs, etc.
Follow [[#Realtime scheduling|Realtime scheduling]] section to resolve the above error message.


== See Also ==
== See also ==


* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]
* [[Bluetooth]]
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]
* Official PipeWire links
** [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home Wiki]
** [https://docs.pipewire.org Documentation site]
** [https://gitlab.freedesktop.org/pipewire/pipewire Source repository]
* [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki]
* [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki]
* [https://wiki.gentoo.org/wiki/Pipewire PipeWire on the Gentoo Wiki]
* [https://wiki.gentoo.org/wiki/PipeWire PipeWire on the Gentoo Wiki]


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

Latest revision as of 20:06, 18 November 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

Installation

Install pipewire and wireplumber (session manager).

# 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.
Currently available in the testing repository.
  • qpwgraph: 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 the section below only if PipeWire is not launched after a relogin/reboot.

Note: 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 Alpine 3.22, PipeWire can be launched as a user service.

User service prerequisites

User service management

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, in Xorg change gui to default:

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

The above steps may be repeated for pipewire-pulse user service.

Note: The pipewire-pulse user 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 the PipeWire 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

Realtime scheduling will increase certain threads priorities to assist with low latency audio processing. By default, PipeWire tries to enable realtime scheduling with the rt module.

Since PipeWire 0.3.66, when you have a PAM login session, you should add your user to the pipewire group.

The default system wide settings are defined in /etc/security/limits.d/25-pw-rlimits.conf. You may want to adjust settings for parameters like rt.prio, if required. Alternatively, it can be set at user level within the ceiling set by the system's rlimits.

Contents of ~/.config/pipewire/pipewire.conf.d/my-rt-args.conf

context.modules = [ { name = libpipewire-module-rt args = { #nice.level = 20 #rt.prio = 88 } flags = [ ifexists nofail ] } ]

If you don't have PAM but D-Bus is available, the rt module will try to use rtkit; if this is the case, add your user to the rtkit group.

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 likely with your PipeWire configuration. Ensure that eudev is installed, and consider double-checking the instructions above.

If no sound devices are found, 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* | grep 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

If you are running Alpine 3.22+ and continue to experience this error after verifying that XDG_RUNTIME_DIR is correctly set, ensure that the pipewire-pulse user service is running.

Bluetooth connect failed: br-connection-profile-unavailable

Ensure wireplumber, the session manager, is running.

Play/Pause buttons not working on bluetooth headphones

Check /var/log/messages for lines similar to:

Contents of /var/log/messages

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 Loading of Kernel Modules 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

Follow Realtime scheduling section to resolve the above error message.

See also