[systemd-devel] masking --global, but allowing --user
Arseny Maslennikov
arseny at altlinux.org
Sat Sep 18 06:57:31 UTC 2021
On Fri, Sep 17, 2021 at 07:02:14PM -0500, Matt Zagrabelny wrote:
> Greetings,
>
> I believe the Debian package of mpd enables a --global .service and
> .socket unit for the mpd daemon/service.
>
> I'd like to mask that and install it just to a single --user service.
>
> I've tried that:
>
> sudo systemctl --global mask mpd.service
> sudo systemctl --global mask mpd.socket
>
> and then:
>
> systemctl --user enable mpd
> Failed to enable unit: Unit file /etc/xdg/systemd/user/mpd.service is
> masked.
> The reason I do not like the --global version is due to logging in on
> a virtual console as root and then mpd starting up and causing issues
> with the preferred service running under my main user account.
>
> Any idea how to solve my problem?
PipeWire and PulseAudio use the following guard on both the socket and
the service:
[Unit]
ConditionUser=!root
This snippet can be put in a override file for mpd's unit either by
hand, or by means of "systemctl --global edit".
It might make sense to suggest this upstream.
> Thanks for any help!
>
> -m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210918/c1eea151/attachment.sig>
More information about the systemd-devel
mailing list