Commit graph

32 commits

Author SHA1 Message Date
Timo Gurr
814d409501 systemd: Add systemd-system-unit-dir override 2022-01-06 12:17:10 +00:00
Petros Angelatos
5054b48c9d systemd: correctly prefix systemd system units
The definition of the `systemdsystemunitdir` variable uses `rootprefix`
instead of `prefix`:

https://github.com/systemd/systemd/blob/v250/src/core/systemd.pc.in#L23

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2021-12-31 20:47:56 +01:00
Barnabás Pőcze
b666edde78 daemon: meson.build: use get_variable()
Use `get_variable()` on the dependency instead of `get_pkgconfig_variable()`
as that has been deprecated in meson 0.56.0.
2021-12-28 18:37:10 +01:00
Peter Hutterer
34847f117f systemd: extend the description for the socket files
Let's add PipeWire and Socket into the description, the current messages
are not overly obvious:
   Listening on Multimedia System.
   Closing Multimedia System.
2021-11-15 10:17:39 +10:00
Peter Hutterer
1bced6b2ef Remove media-session from this tree
It is now available as a separate project in
https://gitlab.freedesktop.org/pipewire/media-session

The code required by pw-reservice has moved to src/tools/reserve.{c|h}
2021-10-18 20:44:07 +10:00
Peter Hutterer
4ea8fa8180 systemd: make pipewire-pulse require one of the session managers
Where pipewire and friends are started via socket activation,
a PA client connection to the pulse socket triggers
pipewire-pulse.service. That in turn triggers pipewire.service through
Wants/After and once that is started up, pipewire-pulse actually
starts up.

At the same time, pipewire-media-session or wireplumber are started
through WantedBy/after in the respective service files.

Depending on which leg the race condition got out of bed with today,
pipewire-pulse may be finished before the session manager has set up the
graph and the PA client doesn't see any devices.

Fix this by adding a dependency on the session manager in
pipewire-pulse, installed via an Alias so media-session and wireplumber
can install the same alias. Wants is a light dependency, so for the case
where it doesn't exist we fall back to the current behavior anyway.

This doesn't remove the race condition since systemd may deem the
session manager to have started before the graph is set up, but it
should reduce the occurances.

The disadvantage here: only one Alias will be installed by systemd, so
first-come, first-serve in the case of both media-session and
wireplumber being installed.

See #1553
2021-09-29 07:18:13 +00:00
Peter Hutterer
90cbcb6c05 systemd: add PipeWire to the systemd service file descriptions
Without this, a journal entry merely looks like this:
 Stopping Multimedia Service ...

Which is obviously terrible from a branding perspective but also makes
it harder for users to figure out what process was responsible for this
entry.
2021-09-29 07:17:35 +00:00
Nils Tonnätt
dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt
f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Niklāvs Koļesņikovs
d7cddbdb61 meson: changes meson switches for controlling session manager
Some distributions set --auto_features=enabled which messes with the
internal logic of the build system when features are used for other
purposes than pure dependency control. The only solution is to either
avoid the value auto or change the type of the option to non-feature.

This commit does the later by replacing -Dmedia-session, -Dwireplumber
and -Dsession-manager with the new -Dsession-managers array and
-Ddefault-session-manager combo options.

Fixes #1333
Fixes #1336
2021-06-24 14:22:13 +00:00
Sjoerd Simons
d2e1b968af Let pipewire-pulse services conflict with their pulseaudio counterparts
You can only run either pulseaudio *or* the pipewire-pulse daemon at one
time. So make the pipewire-pulse units conflict with their pulseaudio
counterparts to avoid both running at the same time
2021-05-22 14:26:30 +02:00
Jonas Holmberg
b1610d37fe modules: Add module-rt
Add a module to set thread priorities without using rtkit.
2021-05-19 17:39:17 +02:00
Jonas Holmberg
0ddfbc0f62 systemd: Increase backlog for unix sockets
Use the default backlog size, SOMAXCONN (128), which is the same as for
the unix socket in module-protocol-native. If the backlog queue gets
full incoming connections will be closed before they can be accepted.
This causes connect() to fail with EAGAIN on the client side and since
the server socket is closed it will not be possible to use the client
socket further.
2021-04-22 07:30:51 +00:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans
78db493d0d pulse-server: depend on pipewire.service
Make sure we only start after the main pipewire.service is started.

See https://bugzilla.redhat.com/show_bug.cgi?id=1943867
2021-04-06 10:24:25 +02:00
Thibault Saunier
485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
George Kiagiadakis
27cfff7965 systemd: do not specify RuntimeDirectory on the media-session service
This will just re-create /run/pipewire for no good reason; the one
in pipewire.service is enough
2021-02-24 21:15:41 +00:00
George Kiagiadakis
32512a8962 systemd: system-mode: preserve /run/pipewire after the daemon stops
/run/pipewire is initially created by pipewire.socket when it creates
the socket file, but it is owned by root with mode 0755.

In the .service unit, RuntimeDirectory=pipewire re-creates /run/pipewire
for user pipewire (owned by pipewire:pipewire, 0755) when this unit starts.
This is necessary for the pipewire daemon to be able to write the .lock file.

By default, when the service unit stops, systemd deletes this runtime
directory and therefore it also deletes the socket that is owned by
pipewire.socket. When this happens, the service is no longer
socket-activateable even though pipewire.socket is active.

RuntimeDirectoryPreserve=yes prevents the service unit from removing
this runtime directory and socket activation still works as expected
2021-02-24 21:15:41 +00:00
George Kiagiadakis
012a68f8ef systemd: add unit files for pipewire-media-session
... and disable starting it from context.exec in the config
2021-02-23 16:21:59 +00:00
George Kiagiadakis
b7c6f70ae3 systemd: add sandboxing also for the system service
Based on dd1bf796cb
and https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/daemon/systemd/user/pulseaudio.service.in

See also: #763
2021-02-23 16:21:59 +00:00
Bryan Quigley
dd1bf796cb systemd: add sandboxing and slice similar to pulseaudio
Adds as much sandboxing as seems to work with user sessions.
Adds pipewire to session slice per https://systemd.io/DESKTOP_ENVIRONMENTS/

Inspired from https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/daemon/systemd/user/pulseaudio.service.in

Fixes: 763
2021-02-19 09:08:51 +00:00
Wim Taymans
cd5ceae69e systemd: remove LimitMEMLOCK lines
The LimitMEMLOCK lines can only lower the use limits so it is not
very useful.

See #692
2021-02-08 14:56:50 +01:00
Wim Taymans
c866d5c1f4 Increase memlock limits in systemd service files 2021-01-22 13:18:48 +01:00
Jarkko Sakkinen
ec9dfe72ff systemd: Add systemd-user-unit-dir override
Add a new build option 'system-user-unit=dir', which can be used to
override the pkg-config default value.

By doing this, it becomes more practical to make a local unprivileged
build of the latest PipeWire:

$ meson --prefix=~/.local build
$ meson configure build -Dpipewire-alsa=false
$ meson configure build -Dsystemd-user-unit-dir=~/.config/systemd/user
$ meson configure build -Dudevrulesdir="`mktemp -d`"
$ ninja -C build install

For a local build enabling ALSA plugins is not plausible.

JACK needs a simple addition to the ~/.profile:

export LD_LIBRARY_PATH=$HOME/.local/lib/x86_64-linux-gnu/pipewire-0.3/jack

Finally, the genuine PulseAudio must be masked and local services
enabled:

systemctl --user enable pipewire.socket
systemctl --user enable pipewire-pulse.socket
systemctl --user mask pulseaudio.service

A sanity check [*] shows that nothing has leaked out of the home
directory (even though at least on my Debian 10 system PolKit still
asks for authorization during the meson build).

Not perfect, but lowers a barrier to run the development version a lot,
as that does not anymore to trash your system.

[*]  find / -name "*pipewire*" \! -path "/home/*"  \! -path "/var/lib/flatpak/*" 2> /dev/null

Signed-off-by: Jarkko Sakkinen <jarkko@suppilovahvero.lan>
2021-01-09 12:11:22 +01:00
Ihor Kalnytskyi
8942f6b402 launch: avoid autostarting pipewire-pulse systemd units for root
Long story short, this is something pulseaudio has since 2017 [1]. If
pipewire-pulse is aiming to be a drop-in replacement, the same behaviour
is probably expected.

I noticed that without this line I hit some issues with systemd socket
activation. In fact, it does not work properly at all. It probably has
something to do with the fact that pipewire-pulse is started for GDM
session and is somehow propagated down to my own user session.

[1] 24928d6b6f
2020-12-28 13:35:41 +01:00
Wim Taymans
798bcc10b1 pulse: add a small pulseaudio daemon
Add a small application that loads the pulse server and makes it
listen on the pulseaudio socket.
Add some systemd activation files to start the service.
2020-11-12 16:53:55 +01:00
Jonas Holmberg
5c52670421 systemd: Add system service and socket
Add system service and socket in addition to the user service and
socket. The system service is started as pipewire user and group and
clients need to be in the pipewire group to be able to connect.
2020-08-19 17:46:50 +00:00
worldofpeace
6b06341b14 build: use define_variable for get_pkgconfig_variable
On NixOS all packages are installed into their own immutable prefix.
Because of this get_pkgconfig_variable will return a
path from within systemd's prefix and we cannot write to it.
By using define_variable we can replace the respective directory
to be from the paths from meson.
2020-03-02 14:51:27 +00:00
Wim Taymans
1ace2a5daf make systemd dependency optional
Don't recurse into the directory of systemd when it was not found.
There are still some issues because libudev is actually provided
by systemd these days and we still need that for building the v4l2 and
alsa monitors.
2017-12-14 09:30:34 +01:00
Wim Taymans
b7e334e55d Release 0.1.4
Remove spec file
Fix systemd service file
Send error on link errors
Init socket to -1 so that we don't close anything on error
Wait for all proxy objects in device monitor
2017-08-23 13:22:39 +02:00
Wim Taymans
593df62ccc update spec 2017-08-17 19:42:10 +02:00
Wim Taymans
29eb58f7a2 Add systemd socket activation files
Notify of jack graph changes
2017-08-17 18:59:03 +02:00