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
This commit is contained in:
George Kiagiadakis 2021-02-24 22:05:14 +02:00 committed by Wim Taymans
parent 2491f56355
commit 32512a8962

View file

@ -25,6 +25,7 @@ Type=simple
ExecStart=@PW_BINARY@ ExecStart=@PW_BINARY@
Restart=on-failure Restart=on-failure
RuntimeDirectory=pipewire RuntimeDirectory=pipewire
RuntimeDirectoryPreserve=yes
User=pipewire User=pipewire
Environment=PIPEWIRE_RUNTIME_DIR=%t/pipewire Environment=PIPEWIRE_RUNTIME_DIR=%t/pipewire