[systemd-devel] systemd-inhibit fails when run from a service file

Lennart Poettering lennart at poettering.net
Mon Jan 13 09:33:51 UTC 2020


On Di, 26.11.19 13:55, Amish (anon.amish at gmail.com) wrote:

> If I change code to not call systemd-inhibit:
>
> $ cat /home/foo/downloads/dnld.sh
> #!/bin/bash
> /home/foo/downloads/dnld.pl
>
> Then service file runs fine.
>
> # systemctl start dnld.service; sleep 30
> # journalctl -u dnld.service
> Nov 26 13:50:17 foo systemd[1]: Started Download files.
> Nov 26 13:50:37 foo systemd[1]: dnld.service: Succeeded.
>
> So how do I allow systemd-inhibit call when a script is called via systemd
> instead of directly?
>
> Is this systemd bug or am I missing something in dnld.service file?

You need to allow this in PolicyKit. if you request an inhibitor from
a login shell you get policykit privs because of the default
policy. If you do this from a non-logged in user you won't, and need
to adjust the policy.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list