PipeWire

From Alpine Linux

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