[systemd-devel] systemd-inhibit --what=handle-power-key broken with systemd 198

Lennart Poettering lennart at poettering.net
Fri Mar 29 08:03:52 PDT 2013

On Wed, 27.03.13 23:17, Manuel Reimer (Manuel.Spam at nurfuerspam.de) wrote:

> Just one more information: It seems like the inhibitors work if I'm
> on the same shell/virtual terminal where the inhibitor was created.

Yes, that's correct. Key handling for this is per-VT.

Generally on Linux only the X session in the fg will get the
keypresses. If you switch away with from it, the new one in the bg will
get it instead. logind will get active hence only if there's nobody on
that specific VT who wants to take the events.

> So the inhibitors, created by KDE, only work if I'm on the KDE
> screen. If I switch to another VT, then the power button forcefully
> shuts down the system.


> Seems like I'm seeing the same effect with my code, but as I want to
> use an inhibitor in a daemon that gets started by systemd while the
> system boots, this doesn't make much sense for me.

Well, note that these specific inhibitors are about inhibiting key
presses, not actions. i.e. the inhibitor for logind's suspend key
(i.e. the handling of the key) is independent of the inhibiting for the
suspend (i.e. the action code can ask for).

See: http://www.freedesktop.org/wiki/Software/systemd/inhibit


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list