[pulseaudio-discuss] [PATCH v3] systemd: disable socket activation for root
tanuk at iki.fi
Tue Feb 14 09:06:40 UTC 2017
We disallow autospawning for root, but when using systemd socket
activation to start pulseaudio, that replaces the autospawning
mechanism, and there was no similar "root protection" in socket
activation. This patch disables the socket activation for root.
src/daemon/systemd/user/pulseaudio.socket | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/daemon/systemd/user/pulseaudio.socket b/src/daemon/systemd/user/pulseaudio.socket
index 332ece893..cdaee5b77 100644
@@ -6,5 +6,15 @@ Priority=6
+# We don't want to enable socket activation for root, because alsa device
+# handover doesn't work between root and normal users.
+# Using ExecStartPre is not quite ideal, because the unit state becomes
+# "failed", which can make people think that something went wrong, even though
+# this is normal behaviour. A request has been submitted for a more
+# straightforward way to make units conditional based on the user:
+ExecStartPre=/bin/sh -c '/usr/bin/test $(/usr/bin/whoami) != "root"'
More information about the pulseaudio-discuss