Bug 66321 - shutdown-inhibitor from user session is ignored when calling org.freedesktop.login1.Manager.Suspend or org.freedesktop.login1.Manager.PowerOff
Summary: shutdown-inhibitor from user session is ignored when calling org.freedesktop....
Status: RESOLVED NOTABUG
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-28 13:43 UTC by Alexander Grothe
Modified: 2013-09-12 18:06 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Grothe 2013-06-28 13:43:53 UTC
Hello,
I am running Arch Linux with systemd-204 (https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/systemd&id=770b03b35a8c53b5d5e23738ae66138856aebf3e) and a gnome-session started by gdm (version 3.8.3).

I am trying to use a shutdown-inhibitor which reliably blocks a shutdown or suspend if a script running in the background within the session is busy.

So I set up a "block" mode inhibitor from a terminal:
$ systemd-inhibit --who=test vim
It showed up correctly:
$ systemd-inhibit --list
[...]
     Who: test (UID 1000/alexander, PID 547/systemd-inhibit)
    What: shutdown:sleep:idle
     Why: Unknown reason
    Mode: block

systemctl itself respects this inhibitor:
$ systemctl poweroff
Operation inhibited by "test" (PID 547 "systemd-inhibit", user alexander), reason is "Unknown reason".
Please retry operation after closing inhibitors and logging out other users.
Alternatively, ignore inhibitors and users with 'systemctl poweroff -i'.

But when calling login1 directly, the system is shut down without further notice or authorization request(for example XBMC uses a dbus command like this):
$ dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:false

If the inhibitor is set by root, both "systemctl poweroff" and a dbus-request show the expected behavior:
# systemd-inhibit --who="test as root" vim
$ systemctl poweroff
Operation inhibited by "test as root" (PID 564 "systemd-inhibit", user root), reason is "Unknown reason".
Please retry operation after closing inhibitors and logging out other users.
Alternatively, ignore inhibitors and users with 'systemctl poweroff -i'.
$ dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:false
Error org.freedesktop.DBus.Error.AccessDenied: Operation not permitted

I is possible that all inhibitor are reliably taken into account for org.freedesktop.login1.Manager.* calls, regardless of the owner?
Comment 1 Lennart Poettering 2013-09-12 18:06:09 UTC
The owner of an inhibitor can always ignore his own inhibitor, but not the inhibitors of other users. That is intended behaviour. 

The idea for this is that desktop environments check for inhibitors on logout manually, show a nice UI, and offer an "override" button if the inhibitors could be overriden.

So yeah, this is really intended behaviour.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.