[systemd-devel] "Failed to enable unit: Access denied"?

Divine Eguzouwa divine.eguzouwa at gmail.com
Thu Jun 13 14:24:34 UTC 2024


I am unable to freely create & enable user unit files and I'm not sure why

$ systemctl edit --user --force --full test.service
Successfully installed edited file
'/home/me/.config/systemd/user/test.service'.

$ cat /home/me/.config/systemd/user/test.service
[Unit]
Description=Test user unit files
[Service]
ExecStart=/bin/sh -c true
[Install]
WantedBy=default.target

$ systemd-analyze verify /home/me/.config/systemd/user/test.service

$ systemctl --user daemon-reload

$ systemctl --user enable test.service
Failed to enable unit: Unit file test.service does not exist.

$ systemctl --user enable /home/me/.config/systemd/user/test.service
Failed to enable unit: Access denied

$ systemd-analyze --user unit-paths
/home/me/.config/systemd/user.control
/run/user/60065/systemd/user.control
/run/user/60065/systemd/transient
/run/user/60065/systemd/generator.early
/home/me/.config/systemd/user
/etc/xdg/systemd/user
/etc/systemd/user
/run/user/60065/systemd/user
/run/systemd/user
/run/user/60065/systemd/generator
/home/me/.local/share/systemd/user
/usr/local/share/systemd/user
/usr/share/systemd/user
/usr/local/lib/systemd/user
/usr/lib/systemd/user
/run/user/60065/systemd/generator.late

$ ls -la /home/me/.config/systemd/user
total 12
drwxr-xr-x 2 me me 4096 Jun 13 09:42 .
drwxr-xr-x 3 me me 4096 Jun 13 09:42 ..
-rw-r--r-- 1 me me  112 Jun 13 09:42 test.service

$ cat /etc/profile.d/xdg-user-dirs.sh
#!/bin/sh
# org.freedesktop.xdg
XDG_CONFIG_HOME=$HOME/.config
XDG_CACHE_HOME=$HOME/.cache
XDG_DATA_HOME=/$HOME/.local/share
XDG_STATE_HOME=$HOME/.local/state


I would have thought systemctl edit --user sorts out those pesky
permissions issues. All available information on troubleshooting this issue
that I have been able to gather only pertains to SELinux machines, which
doesn't apply here.

...I missed a step, didn't I?

--D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240613/a1ecbb72/attachment.htm>


More information about the systemd-devel mailing list