[systemd-devel] Can't Inhibit shutdown with logind
Lennart Poettering
lennart at poettering.net
Tue Jun 4 10:46:55 PDT 2013
On Tue, 28.05.13 01:28, Brendan J (bhenryj0117 at googlemail.com) wrote:
> Hi all,
>
> I'm trying to use the Inhibit() API exposed by logind on dbus
> (org.freedesktop.login1.Manager) to prevent shutdown.
> The call seems superficially to have worked, as the result from
> ListInhibitors() includes the block I created. However my machine is not
> prevented from shutting down.
>
> I'm pretty stumped on how to proceed with debugging this, beyond checking
> what signals get sent (my program receives PrepareForShutdown(true)).
> Could anyone suggest anything?
Note that inhibitors aren't something that protects you from
yourself. System inhibitors a user took will inhibit shutdown for
everybody else, but not for him, and not for root. The idea is that a
user should always be able to override his apps if he really wants
to. It is the job of your DE to present active locks on screen when the
user selects shutdown, and if he really wants to ignore them to forward
this to the system.
Or in other words: if you ran your test code as the same user as the one
initiating the shutdown it's not surprising nothong was inhibited.
Also note that suspending via lid-close by default ignores inhibitors
since there is no way to show such an override message since we cannot
stop the user from closing the lid. (But you can change this via
LidSwitchIgnoreInhibited=).
Does this explain the issue? Otherwise, you need to give me more details
what you exactly tried as which users...
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list