Bug 351365

Summary: can't suspend/hibernate from KDE application menu
Product: [Plasma] Powerdevil Reporter: Thomas Masper <thomas.masper>
Component: generalAssignee: Plasma Development Mailing List <plasma-devel>
Status: RESOLVED FIXED    
Severity: normal CC: kde, stupor_scurvy343
Priority: NOR    
Version: 5.3.90   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.4.0
Sentry Crash Report:
Attachments: Use UPower if CK2 is not available

Description Thomas Masper 2015-08-16 15:01:48 UTC
After update to powerdevil 5.3.90 I cannot anymore suspend/hibernate the laptop from KDE application menu or when closing the lid.
The suspend/hibernate option are still present but clicking on them just make the lock screen appear.

Reproducible: Always

Steps to Reproduce:
1. Log in in KDE
2. Application menu->Power / Session -> suspend
3.

Actual Results:  
Screen go black, after some second the lock screen (SDDM) appear

Expected Results:  
The laptop will suspend to RAM

Gentoo Linux kernel 4.0.5 ck-sources (NO systemd)
- sys-auth/polkit-0.112-r3 
- sys-auth/consolekit-0.4.6 
- sys-power/upower-pm-utils-0.9.23-r2 
- sys-apps/openrc-0.17 
- kde-plasma/powerdevil-5.3.95
- kde-plasma/polkit-kde-agent-5.3.95

Downgrading powerdevil to version 5.3.2 fix the issue.
The issue seems related not using UPower (like was in powerdevil-5.3.2) to start suspend job but instead using Login1 (see the xsession-errors below).

.xsession-errors (log related to suspend action) with powerdevil-5.3.95:
powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true) ) ( "Type" ,  QVariant(uint, 1) ) ) 
powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true) ) ( "SkipFade" ,  QVariant(bool, true) ) ( "Type" ,  QVariant(uint, 1) ) ) 
powerdevil: Starting Login1 suspend job
powerdevil: Failed to start suspend job "org.freedesktop.DBus.Error.AccessDenied" "Rejected send message, 2 matched rules; type="method_call", sender=":1.12" (uid=1000 pid=8305 comm="kded5 [kdeinit5]                                  ") interface="org.freedesktop.ConsoleKit.Manager" member="Suspend" error name="(unset)" requested_reply="0" destination="org.freedesktop.ConsoleKit" (uid=0 pid=6430 comm="/usr/sbin/console-kit-daemon ")"

.xsession-errors (log related to suspend action) with powerdevil-5.3.2:
powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true) ) ( "Type" ,  QVariant(uint, 1) ) ) 
powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true) ) ( "SkipFade" ,  QVariant(bool, true) ) ( "Type" ,  QVariant(uint, 1) ) ) 
powerdevil: Starting UPower suspend job
powerdevil: fd passing available: true
powerdevil: failed to inhibit systemd powersave handling
Comment 1 Kai Uwe Broulik 2015-08-16 15:04:25 UTC
Do you have ConsoleKit2 installed?
Comment 2 Thomas Masper 2015-08-16 15:13:37 UTC
No, I do not have ConsoleKit2 installed. The only version in gentoo packages of consolekit, is version 0.4.6 (the one I have installed).
Comment 3 Kai Uwe Broulik 2015-08-16 15:14:46 UTC
Ok, so the thing is, we now support ConsoleKit 2 which uses the same DBus service name as ConsoleKit 1. CK2 has an features similar to Login1 so both can be supported easily.

However, there's no way for us to tell that we're using CK1 not CK2 so we now use Login1/CK2 suspend as soon as CK interface is there no matter if CK1 and CK2. Given we'll drop support for ConsoleKit 1 starting in 5.5 I'm not sure it makes sens to introduce a hack for this now that'll be removed eventually anyway. But thanks for the headsup, there's a bunch of other CK1 specific code there I forgot to remove :P
Comment 4 Kai Uwe Broulik 2015-08-16 15:20:10 UTC
Created attachment 94058 [details]
Use UPower if CK2 is not available

Can you try this patch?
Comment 5 Thomas Masper 2015-08-16 16:29:11 UTC
Hi Kay,
I applied the patch and now I can suspend/hibernate also with version 5.3.95.
This is my first bug report, so let me know if you need some more action from my side (I don't know what I should do now).

thanks
Comment 6 Kai Uwe Broulik 2015-08-16 16:40:44 UTC
Thanks, cool. I posted it on review so other developers can have a look and we ensure not to break other hardware. It should be fixed in time for 5.4 final release.
Comment 7 Kai Uwe Broulik 2015-08-17 08:54:49 UTC
Git commit 41d369f7c57b31f13cb120d09b3e9f71119d86f4 by Kai Uwe Broulik.
Committed on 17/08/2015 at 08:54.
Pushed by broulik into branch 'Plasma/5.4'.

Suspend using UPower in case of ConsoleKit 1

REVIEW: 124778
FIXED-IN: 5.4.0

M  +6    -2    daemon/backends/upower/powerdevilupowerbackend.cpp
M  +1    -0    daemon/backends/upower/powerdevilupowerbackend.h

http://commits.kde.org/powerdevil/41d369f7c57b31f13cb120d09b3e9f71119d86f4