Bug 1263572

Summary: print more details about inhibit lock when user wants to power off the system
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: gnome-shellAssignee: Florian Müllner <fmuellner>
Status: CLOSED WONTFIX QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: mclasen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-24 19:15:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Srot 2015-09-16 08:38:14 UTC
Description of problem:

When a user wants to shut down a system while the shutdown is prevented by systemd inhibit lock the message displayed is not very helpful in clarifying the reason for the lock (or that there is any lock at all)

The actual message is:
With RHEL-7.1, gnome-shell-3.8.4-45.el7.x86_64
Authentication is required for powering off the system while an application asked to inhibit it

With RHEL-7.2, gnome-shell-3.14.4-24.el7.x86_64
no window/message is displayed at all

Version-Release number of selected component (if applicable):
gnome-shell-3.8.4-45.el7.x86_64
gnome-shell-3.14.4-24.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. ### set up an inhibit lock, e.g. by installing rpm-plugin-systemd-inhibit and executing rpm/yum transaction or
# systemd-inhibit --what=shutdown --who=root --why="because I can" --mode=block sleep 60
2. try to shutdown a system from gnome-shell
3.

Actual results:
Authentication is required for powering off the system while an application asked to inhibit it
or
No information at all that the shutdown was prevented (gnome-shell-3.14.4-24.el7.x86_64)

Expected results:
Authentication is required for powering off the system while an application asked to inhibit it:
     Who: RPM (UID 0/root, PID 3401/yum)
     Why: Transaction running


Additional info:

This information is visible in the console

[root@localhost ~]# systemd-inhibit --list
     Who: NetworkManager (UID 0/root, PID 728/NetworkManager)
    What: sleep
     Why: NetworkManager needs to turn off networks
    Mode: delay

     Who: test (UID 1001/test, PID 2835/gnome-settings-)
    What: sleep
     Why: GNOME needs to lock the screen
    Mode: delay

     Who: test (UID 1001/test, PID 2835/gnome-settings-)
    What: handle-lid-switch
     Why: Multiple displays attached
    Mode: block

     Who: test (UID 1001/test, PID 2835/gnome-settings-)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key
     Why: GNOME handling keypresses
    Mode: block

     Who: GNOME Shell (UID 1001/test, PID 2979/gnome-shell)
    What: sleep
     Why: GNOME needs to lock the screen
    Mode: delay

     Who: RPM (UID 0/root, PID 3401/yum)
    What: shutdown
     Why: Transaction running
    Mode: block

     Who: RPM (UID 0/root, PID 3401/yum)
    What: shutdown
     Why: Transaction running
    Mode: block

7 inhibitors listed.

[test@localhost root]$ reboot
Operation inhibited by "RPM" (PID 3401 "yum", user root), reason is "Transaction running".
Operation inhibited by "RPM" (PID 3401 "yum", user root), reason is "Transaction running".
User root is logged in on sshd.
User root is logged in on sshd.
Please retry operation after closing inhibitors and logging out other users.
Alternatively, ignore inhibitors and users with 'systemctl reboot -i'.