[systemd-devel] weird systemd-inhibit behaviour

Lennart Poettering lennart at poettering.net
Fri Jul 13 14:26:10 UTC 2018


On Do, 28.06.18 22:24, Amish (anon.amish at gmail.com) wrote:

> It goes ahead and performs the action even if I am not using -i
> (--ignore-inhibitors) switch.
> 
> Documentation for -i (--ignore-inhibitors) states this:
> If any locks are taken, shutdown and sleep state requests will normally fail
> (regardless of whether privileged or not) and a list of active locks is
> printed.
> 
> It clearly states - "privileged or not" - so even if I am running systemctl
> as root - it should not shutdown or sleep in above case.

The docs are simply wrong on this one, please file a bug, so we fix them!

> Case 2)
> Inside graphical.target - using KDE plasma - logged in as a non-root user.
> 
> Same first command as in case 1).
> 
> # logged into KDE as non-root user but command below run as root inside
> konsole
> # systemd-inhibit --what=handle-hibernate-key:handle-lid-switch:handle-power-key:handle-suspend-key:idle:sleep:shutdown
> sleep 300 &
> 
> Now if I click KDE Menu-->Leave-->Suspend (Suspend to RAM) ... it blocks
> suspend and asks me for root password - stating that there is an inhibitor.
> 
> But if I click KDE Menu-->Leave-->Shut Down ... it goes ahead and shuts down
> the machine.

What happens if you run "systemctl -i poweroff" as unpriv user? Is
that honoured, or does that fail?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list