Skip to content

Commit 47787d2

Browse files
committed
config/media/pipewire: rewrite for clarity
it seems a lot of people have trouble with this guide, and there's a lot of forks/options at each step. This rewrites the guide to streamline it into "basic setup" (wireplumber and optionally pw-pulse) and "optional setup" (everything else). Also, this only documents the conf.d method as it's the most straightforward (IMO) and provides consistent results (wrt launch order and ensuring things are launched). I don't think we need to document every single option and overwhelm users, this guide is already very verbose.
1 parent 1a60a58 commit 47787d2

File tree

1 file changed

+163
-95
lines changed

1 file changed

+163
-95
lines changed

src/config/media/pipewire.md

Lines changed: 163 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,178 @@
11
# PipeWire
22

3-
To use PipeWire, install the `pipewire` package.
4-
5-
[pipewire(1)](https://man.voidlinux.org/pipewire.1) should be started as a user.
6-
Run the pipewire command in a terminal emulator in your session.
3+
PipeWire is a modern server for handling audio (and video) streams. It is highly
4+
flexible and can interface with applications designed for ALSA, PulseAudio, and
5+
JACK audio systems. It is also designed to work well with Flatpak applications
6+
and provides a method for screenshotting and screensharing on Wayland via
7+
[xdg-desktop-portal](../graphical-session/portals.md).
8+
9+
## Prerequisites
10+
11+
PipeWire requires an active [D-Bus user session
12+
bus](../session-management.md#d-bus). If your desktop environment, window
13+
manager, or Wayland compositor is configured to provide this, no further
14+
configuration should be required. If not, the desktop environment, window
15+
manager, or Wayland compositor may need to be launched with
16+
[`dbus-run-session(1)`](https://man.voidlinux.org/dbus-run-session.1).
17+
18+
PipeWire also requires the
19+
[`XDG_RUNTIME_DIR`](../session-management.html#xdg_runtime_dir) environment
20+
variable to be defined in your environment to work properly.
721

8-
```
9-
$ pipewire
10-
```
22+
If not using [elogind](../session-management.md), it is necessary to be in the
23+
`audio` group to access audio devices and the `video` group to access video
24+
devices.
1125

12-
When pipewire works as expected, use the autostarting mechanism of your desktop
13-
environment or [startx](../graphical-session/xorg.md#startx). The `pipewire`
14-
package ships [Desktop
15-
Entry](https://specifications.freedesktop.org/desktop-entry-spec/latest/) files
16-
for `pipewire` and `pipewire-pulse` in `/usr/share/applications`. If your
17-
environment supports the [Desktop Application Autostart
18-
Specification](https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html),
19-
you can enable pipewire by symlinking the desktop files to the autostart
20-
directory:
26+
## Basic Setup
2127

22-
```
23-
# ln -s /usr/share/applications/pipewire.desktop /etc/xdg/autostart/pipewire.desktop
24-
```
28+
To use PipeWire, install the `pipewire` package. This will also install a
29+
PipeWire session manager, `wireplumber`.
2530

26-
## Session Management
31+
### Session Management
2732

2833
In PipeWire, a session manager assumes responsibility for interconnecting media
2934
sources and sinks as well as enforcing routing policy. Without a session
30-
manager, PipeWire will not function. The reference
31-
[`pipewire-media-session`](https://gitlab.freedesktop.org/pipewire/media-session)
32-
was originally provided in the Void `pipewire` package and configured to run by
33-
default to satisfy this requirement. However, `pipewire-media-session` is
34-
deprecated and the authors recommend using
35-
[WirePlumber](https://pipewire.pages.freedesktop.org/wireplumber/) in its place.
36-
Install the `wireplumber` package to use this session manager with PipeWire.
35+
manager, PipeWire will not function.
3736

3837
> If you have installed an earlier version of the Void `pipewire` package, make
3938
> sure to update your system to eliminate any stale system configuration that
40-
> may attempt to launch `pipewire-media-session`. Users who previously overrode
41-
> the system configuration to use `wireplumber`, *e.g.* by placing a custom
42-
> `pipewire.conf` file in `/etc/pipewire` or `${XDG_CONFIG_HOME}/pipewire`, may
43-
> wish to reconcile these overrides with `/usr/share/pipewire/pipewire.conf`
44-
> installed by the most recent `pipewire` package. If the sole purpose of a
45-
> prior override was to disable `pipewire-media-session`, deleting the custom
46-
> configuration may be sufficient.
47-
48-
There are several methods for starting `wireplumber` alongside `pipewire`. If
49-
your window manager or desktop environment auto-start mechanism is used to start
50-
`pipewire`, it is recommended to use the same mechanism for starting
51-
`wireplumber`. The `wireplumber` package includes a `wireplumber.desktop`
52-
Desktop Entry file that may be useful in this situation.
53-
54-
> Be aware that `wireplumber` must launch *after* the `pipewire` executable. The
55-
> Desktop Application Autostart Specification makes no provision for ordering of
56-
> services started via Desktop Entry files. When relying on these files to
57-
> launch `pipewire` and `wireplumber`, consult the documentation for your window
58-
> manager or desktop environment to determine whether proper ordering of
59-
> services can be achieved.
60-
61-
If proper ordering of separate `pipewire` and `wireplumber` services is
62-
infeasible, it is possible to configure `pipewire` to launch the session manager
63-
directly. This can be accomplished by running
39+
> may attempt to launch `pipewire-media-session`, the original PipeWire session
40+
> manager. Users who previously overrode the system configuration to use
41+
> `wireplumber`, *e.g.* by placing a custom `pipewire.conf` file in
42+
> `/etc/pipewire` or `${XDG_CONFIG_HOME}/pipewire`, may wish to reconcile these
43+
> overrides with `/usr/share/pipewire/pipewire.conf` installed by the most
44+
> recent `pipewire` package. If the sole purpose of a prior override was to
45+
> disable `pipewire-media-session`, deleting the custom configuration may be
46+
> sufficient.
47+
48+
Currently, there is only one session manager available: WirePlumber. To
49+
configure PipeWire to use this session manager and ensure proper startup
50+
ordering, PipeWire should be configured to launch the session manager directly.
51+
This can be accomplished by running
6452

6553
```
6654
# mkdir -p /etc/pipewire/pipewire.conf.d
6755
# ln -s /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/
6856
```
6957

70-
for system configurations or, for per-user configurations, running
58+
for system-wide configuration, or
7159

7260
```
73-
$ true "${XDG_CONFIG_HOME:=${HOME}/.config}"
61+
$ : "${XDG_CONFIG_HOME:=${HOME}/.config}"
7462
$ mkdir -p "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d"
75-
# ln -s /usr/share/examples/wireplumber/10-wireplumber.conf "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d/"
63+
$ ln -s /usr/share/examples/wireplumber/10-wireplumber.conf "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d/"
7664
```
7765

78-
With either of these configurations, launching `pipewire` should be sufficient
79-
to establish a working PipeWire session that uses `wireplumber` for session
80-
management.
66+
for per-user configuration.
8167

82-
In its default configuration, WirePlumber requires an active [D-Bus
83-
session](../session-management.md#d-bus). If your desktop environment or window
84-
manager is configured to provide a D-Bus session as well as launch `pipewire`
85-
and `wireplumber`, no further configuration should be required. Users wishing to
86-
launch `pipewire` on its own, *e.g.*, in a `.xinitrc` script, may find it
87-
necessary to configure `pipewire` to launch `wireplumber` directly and wrap the
88-
`pipewire` invocation as
68+
### PulseAudio interface
69+
70+
The PulseAudio interface is optional but highly recommended. Most applications
71+
cannot speak directly to PipeWire, but instead speak to PipeWire's PulseAudio
72+
interface.
73+
74+
If `pulseaudio` is installed, uninstall it and ensure `pulseaudio` is not
75+
running.
76+
77+
Modify the PipeWire configuration to launch `pipewire-pulse`:
8978

9079
```
91-
dbus-run-session pipewire
80+
# mkdir -p /etc/pipewire/pipewire.conf.d
81+
# ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/
9282
```
9383

94-
## PulseAudio replacement
84+
for system configurations, or
9585

96-
Before starting `pipewire-pulse`, make sure that the PulseAudio service is
97-
[disabled](../services/index.md#disabling-services) and that no other PulseAudio
98-
server instance is running.
86+
```
87+
$ : "${XDG_CONFIG_HOME:=${HOME}/.config}"
88+
$ mkdir -p "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d"
89+
$ ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d/"
90+
```
9991

100-
Start the PulseAudio server by running `pipewire-pulse` in a terminal emulator.
92+
for per-user configurations.
10193

102-
To check if the replacement is working correctly, use
103-
[pactl(1)](https://man.voidlinux.org/pactl.1) (provided by the
104-
`pulseaudio-utils` package):
94+
### Testing
10595

106-
```
107-
$ pactl info
96+
[pipewire(1)](https://man.voidlinux.org/pipewire.1) should be started as your
97+
user. To test that PipeWire works, run the `pipewire` command in a terminal
98+
emulator in your session:
10899

109-
[...]
110-
Server Name: PulseAudio (on PipeWire 0.3.18)
111-
[...]
112100
```
101+
$ pipewire
102+
```
103+
104+
Launching `pipewire` should be sufficient to establish a working PipeWire
105+
session that uses `wireplumber` for session management.
113106

114-
Once you confirmed that `pipewire-pulse` works as expected, it's recommended to
115-
autostart it from the same place where you start PipeWire. Alternatively, the
116-
`pipewire` configuration can be modified to launch `pipewire-pulse` directly:
107+
The status of WirePlumber can be checked with:
117108

118109
```
119-
# mkdir -p /etc/pipewire/pipewire.conf.d
120-
# ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/
110+
$ wpctl status
111+
PipeWire 'pipewire-0' [0.3.82, ...]
112+
[...]
121113
```
122114

123-
for system configurations, or
115+
If the [PulseAudio interface](#pulseaudio-interface) was configured, use
116+
[pactl(1)](https://man.voidlinux.org/pactl.1) (provided by the
117+
`pulseaudio-utils` package) to ensure it is working properly:
124118

125119
```
126-
$ true "${XDG_CONFIG_HOME:=${HOME}/.config}"
127-
$ mkdir -p "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d"
128-
# ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf "${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d/"
120+
$ pactl info
121+
[...]
122+
Server Name: PulseAudio (on PipeWire 0.3.82)
123+
[...]
129124
```
130125

131-
for per-user configurations.
126+
### Launching Automatically
127+
128+
Once `pipewire` works as expected, it can be configured to launch when starting
129+
a graphical session. There are several ways this can be achieved:
130+
131+
- **Use the autostarting mechanism of your desktop environment**: many desktop
132+
environments have a way to configure applications and programs to start
133+
automatically.
134+
- **Use XDG Desktop Application Autostart**: many desktop environments also
135+
support the [Desktop Application Autostart
136+
Specification](https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html).
137+
The `pipewire` package ships a Desktop Entry file for `pipewire` in
138+
`/usr/share/applications`. If your environment supports the Desktop
139+
Application Autostart, you can start `pipewire` by symlinking the desktop
140+
file to the system (`/etc/xdg/autostart`) or user
141+
(`${XDG_CONFIG_HOME}/autostart` or `~/.config/autostart`) autostart
142+
directory. If you are using a desktop environment, window manager, or Wayland
143+
compositor that does not support this, a tool like
144+
[`dex(1)`](https://man.voidlinux.org/dex.1) can be used to add support for
145+
Desktop Application Autostart, for example: `dex --environment <window
146+
manager> --autostart --search-paths ~/.config/autostart`.
147+
- **Use your window manager's startup scripts**: `pipewire` can be launched
148+
directly from your window manager or Wayland compositor's startup script.
149+
150+
## Optional Setup
132151

133-
## Bluetooth audio
152+
### Command-line and Terminal interfaces
134153

135-
For bluetooth audio to work, install the `libspa-bluetooth` package.
154+
`wpctl` can be used to configure PipeWire when using WirePlumber as [session
155+
manager](#session-management).
136156

137-
## ALSA integration
157+
If using the [PulseAudio interface](#pulseaudio-interface), PulseAudio
158+
configuration tools like `pactl` (from `pulseaudio-utils`) and `ncpamixer` can
159+
also be used.
160+
161+
### Graphical interfaces
162+
163+
`qpwgraph` and `helvum` provide a node-and-graph-style interface for connecting
164+
applications and devices.
165+
166+
If using the [PulseAudio interface](#pulseaudio-interface), PulseAudio
167+
configuration tools like `pavucontrol`, `pavucontrol-qt`, and the widgets and
168+
applets integrated into many desktop environments can also be used to configure
169+
PipeWire.
170+
171+
### Bluetooth audio
172+
173+
Install the `libspa-bluetooth` package.
174+
175+
### ALSA integration
138176

139177
Install `alsa-pipewire`, then enable the PipeWire ALSA device and make it the
140178
default:
@@ -145,7 +183,7 @@ default:
145183
# ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d
146184
```
147185

148-
## JACK replacement
186+
### JACK interface
149187

150188
Install `libjack-pipewire`.
151189

@@ -165,8 +203,38 @@ on glibc-based systems:
165203
# ldconfig
166204
```
167205

206+
then reboot.
207+
168208
## Troubleshooting
169209

170-
The PulseAudio replacement requires the
171-
[`XDG_RUNTIME_DIR`](../session-management.html#xdg_runtime_dir) environment
172-
variable to work correctly.
210+
### Common errors
211+
212+
```
213+
[E][...] mod.rt | [ module-rt.c: 262 pw_rtkit_bus_get()] Failed to connect to system bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
214+
```
215+
216+
This indicates the system D-Bus is not running.
217+
[Enable](../services/index.md#enabling-services) the `dbus` service.
218+
219+
```
220+
[E][...] mod.rt | [ module-rt.c: 262 pw_rtkit_bus_get()] Failed to connect to session bus: D-Bus library appears to be incorrectly set up: see the manual page for dbus-uuidgen to correct this issue. (Failed to open "/var/lib/dbus/machine-id": No such file or directory; Failed to open "/etc/machine-id": No such file or directory)
221+
```
222+
223+
This indicates the [user session D-Bus](../session-management.md#d-bus) is not
224+
running.
225+
226+
```
227+
[E][...] mod.protocol-native | [module-protocol-: 710 init_socket_name()] server 0x55e09658e9d0: name pipewire-0 is not an absolute path and no runtime dir found. Set one of PIPEWIRE_RUNTIME_DIR, XDG_RUNTIME_DIR or USERPROFILE in the environment
228+
```
229+
230+
This indicates [`XDG_RUNTIME_DIR`](../session-management.html#xdg_runtime_dir)
231+
is not set up properly.
232+
233+
### Only a "dummy" output is found
234+
235+
If a session manager (like `wireplumber`) is not running, [configure
236+
it](#session-management) and restart PipeWire.
237+
238+
If a session manager is running, check if your user is in the `audio` and
239+
`video` groups. If not using `elogind`, this is necessary for PipeWire to access
240+
devices.

0 commit comments

Comments
 (0)