[pulseaudio-discuss] [PATCH] launch: avoid autostarting pulseaudio systemd units for root
Felipe Sateler
fsateler at debian.org
Thu Sep 7 13:06:09 UTC 2017
On Thu, Sep 7, 2017 at 9:01 AM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Wed, 2017-09-06 at 19:55 -0300, Felipe Sateler wrote:
> > The autospawn mechanism already had a root-autospawn protection
> mechanism. When
> > using systemd that was lost. Systemd 234 has a mechanism to
> conditionalize unit starting
> > on the running user, so lets do that to protect against root
> autospawning.
> > ---
> > src/daemon/systemd/user/pulseaudio.service.in | 1 +
> > src/daemon/systemd/user/pulseaudio.socket | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/src/daemon/systemd/user/pulseaudio.service.in
> b/src/daemon/systemd/user/pulseaudio.service.in
> > index 2bd780f8..46897bf5 100644
> > --- a/src/daemon/systemd/user/pulseaudio.service.in
> > +++ b/src/daemon/systemd/user/pulseaudio.service.in
> > @@ -14,6 +14,7 @@ Description=Sound Service
> > # After=pulseaudio.socket is not needed, as it is already implicit in
> the
> > # socket-service relationship, see systemd.socket(5).
> > Requires=pulseaudio.socket
> > +ConditionUser=!root
> >
> > [Service]
> > # Note that notify will only work if --daemonize=no
> > diff --git a/src/daemon/systemd/user/pulseaudio.socket
> b/src/daemon/systemd/user/pulseaudio.socket
> > index 332ece89..98c1002a 100644
> > --- a/src/daemon/systemd/user/pulseaudio.socket
> > +++ b/src/daemon/systemd/user/pulseaudio.socket
> > @@ -1,5 +1,6 @@
> > [Unit]
> > Description=Sound System
> > +ConditionUser=!root
> >
> > [Socket]
> > Priority=6
>
> What happens if these units are used with older systemd versions? Is
> the unrecognized option just ignored?
>
>
Yes. Systemd will emit a warning like this though:
systemd[23564]: [/home/felipe/.config/systemd/user/test.service:2] Unknown
lvalue 'ConditionUser' in section 'Unit'
Saludos
<https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20170907/6bdccc91/attachment.html>
More information about the pulseaudio-discuss
mailing list