<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Closing lid with multiple sessions open fails with an polkit authentication session on the inactive session"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=85518">85518</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Closing lid with multiple sessions open fails with an polkit authentication session on the inactive session
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>odyx@debian.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>