Bug 294712

Summary: KDE locks the screen before getting the reply from upowerd for its suspend/hibernate request
Product: [Frameworks and Libraries] solid Reporter: Tamás Németh <nt1277>
Component: powermanagementAssignee: Dario Freddi <drf>
Status: RESOLVED FIXED    
Severity: normal CC: afiestas, emailej, kde, oliver.henshaw, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: 4.11   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Bug Depends on: 318461    
Bug Blocks:    

Description Tamás Németh 2012-02-23 21:01:11 UTC
Version:           4.7 (using KDE 4.7.2) 
OS:                Linux

KDE asks upowerd via DBUS to suspend/hibernate. This request is equivalent to something like this:

dbus-send --system --dest=org.freedesktop.UPower --print-reply --type=method_call /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

Upowerd then asks polkitd to authenticate this action. Given that by default, this action is allowed to active sessions, KDE thinks that it will succeed anyway and locks the screen before getting answer from upowerd.

However, if I change the authentication settings (e.g. by copying /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.upower.hibernate.pkla to /etc/polkit-1/localauthority/50-local.d and then editing it) and instruct the system to ask for authentication before Upower based shutdown, then polkit-kde-auth presents me with an authentication window.

Now, the system won't hibernate until a successful authentication, but since the screen gets locked immediately after sending the request to upowerd, I don't see the authentication window. I may even thin that hibernation started, and by closing the lid and putting my notebook into its case I may even cause severe overheating, HDD damage or data corruption due to sudden power loss.

If I realize that hibernation didn't start and unlock the screen and authenticate then hibernation succeeds, indeed, but the system will resume with an unlocked screen :-(

This same bug applies to both hibernation and suspension.

Reproducible: Always

Steps to Reproduce:
Configure PolicyKit to request authentication for Upower based suspension/hibernation.

Actual Results:  
KDE locks the screen before PolicyKit authentication.

Expected Results:  
KDE should only lock the screen after receiving the results from upowerd, AFAIK.
Comment 1 Alex Fiestas 2013-03-03 16:19:14 UTC
This has happened to me.
Comment 2 Kai Uwe Broulik 2015-01-25 22:37:38 UTC
Ths should be fixed by the move to Logind in 5.2. PowerDevil now just tells Logind to suspend the session and it will deny that request or invoke the lock screen if configured to and then power down the system if locking has succeeded.
PowerDevil no longer invokes the screen locker directly.