Bug 85518 - Closing lid with multiple sessions open fails with an polkit authentication session on the inactive session
Summary: Closing lid with multiple sessions open fails with an polkit authentication s...
Status: RESOLVED NOTOURBUG
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-27 14:56 UTC by Didier 'OdyX' Raboud
Modified: 2015-02-04 17:15 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Didier 'OdyX' Raboud 2014-10-27 14:56:06 UTC
Hi,

here's my use-case: I routinely have two KDE sessions open and want my laptop lid closure to always suspend the (X220 Thinkpad) laptop. According to /usr/share/polkit-1/actions/org.freedesktop.login1.policy , this is what
should happen.

Besides, it doesn't: when closing the laptop lid, the two sessions get
locked by KDE and the _inactive_ session gets a (hidden by the locking
screen) PolKit authentication screen. The laptop doesn't suspend (as
the action is inhibited by this authentication screen). When opening the
lid, I can unlock the inactive session and authenticate through the
PolKit authentication window and the laptop suspens _then_.

(The doubly annoying factor is that I use fprintd for this inactive
session, which means that on lid closure, the fingerprint reader powers
up, heats _and_ is inaccessible as below the screen. [It powers up for
the PolKit authentication window]).

Now, I've investigated and added a
/etc/polkit-1/localauthority/50-local.d/force-suspend.pkla file with the
following content:
	[Enforce the suspension on lid close]
	Identity=unix-user:*
	Action=org.freedesktop.login1.suspend-multiple-sessions
	ResultInactive=no

(That's a transformation of the corresponding
<allow_inactive>auth_admin_keep</allow_inactive> from
/usr/share/polkit-1/actions/org.freedesktop.login1.policy into
<...>no<...>)

The addition of this file makes the suspension work reliably from any of
the two active sessions, without a prompt on the other (inactive)
session. I suggest changing the value of allow_inactive for
suspend-multiple-sessions to 'no' then.

Is this the consequence of the following output ?

$ systemd-inhibit --list
     Who: PowerDevil (UID 1001/diidier, PID 2595/kded4)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch
     Why: KDE handles power events
    Mode: block

     Who: PowerDevil (UID 1000/didier, PID 6164/kded4)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch
     Why: KDE handles power events
    Mode: block

     Who: NetworkManager (UID 0/root, PID 912/NetworkManager)
    What: sleep
     Why: NetworkManager needs to turn off networks
    Mode: delay

3 inhibitors listed.

(aka 2 powerdevils launched, and blocking suspend by default ?)

Please ask if you need other details on my setup.

Cheers,

OdyX
Comment 1 Lennart Poettering 2015-02-04 17:15:31 UTC
If KDE wants to handle the lid switch on its own, then it needs to install PK glue so that it has the rights to do so in all cases... It also should stop handling the lid switch if it is not in the fg.

I am not entirely sure why KDE wants to handle it on its own. It could just leave this to logind, and all would be good, like GNOME does it.

Anyway, this is something to fix in KDE I figure, not in logind. Closing.


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.