[systemd-devel] Failed to inhibit: The operation inhibition has been requested for is already running

Lennart Poettering lennart at poettering.net
Tue Apr 23 11:17:48 UTC 2019

On Do, 18.04.19 08:01, Tom (remyabel at gmail.com) wrote:

> Hi all,
> I'm trying to create a simple timer that will wake up the system from
> suspend and run an operation with systemd-inhibit.
> Contents of test.service:
> [Unit]
> Description=Test
> [Service]
> Type=oneshot
> ExecStart=/bin/systemd-inhibit /bin/su user -c "echo 'Test' >
> $HOME/asdf"
> Contents of test.timer:
> [Unit]
> Description=Test
> [Timer]
> Unit=test.service
> OnCalendar=minutely
> WakeSystem=true
> [Install]
> WantedBy=multi-user.target
> It successfully wakes up the system but spits out the error in the
> title. I have no problem running the script or systemd-inhibit
> manually, but when putting it in the unit combined with systemd-inhibit
> I get that error. Am I missing some basic usage?
> systemd version is systemd-239-12.git8bca462 on Fedora 29.

There#s a race here: while we are executing an operation you want to
inhibit we refuse installing an inhibitor for it (which makes
semantical sense: you want the guarantee that you aren't interrupted
by the operation doing something, but if it's already going on then of
it's too late.

The issue here really is that suspending is a slow operation, that
might take a while, without it's preparations and the follow-up logic
that is run. Which means if you are called at the very moment we
return from suspend then it's very likely the operation is still

I figure we should teach "systemd-inhibit" a way so that it can wait
until any pending operation is complete before attempting to acquire
the inhibitor. Could you please file an RFE issue on github about


Lennart Poettering, Berlin

More information about the systemd-devel mailing list