Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] no suspend or hibernate menu in kmenu
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sat Dec 07, 2013 8:34 pm    Post subject: [SOLVED] no suspend or hibernate menu in kmenu Reply with quote

Since the time we got rid of consolekit and replaced stuff with upower/polkit/systemd, I have not been able to suspend my laptop when I close the lid through KDE. The reason is that somewhere suspend is disabled by upower and powerdevil code is not giving me the option to use suspend (or hibernate) when the lid is closed. I can use pm-utils to do either of these.

I have done a lot of things since this morning and gave up. And hence asking here. Here is what I tried:

1. Modify polkit rules

Code:
# cat /etc/polkit-1/rules.d/01-default.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.suspend" ||
        action.id == "org.freedesktop.upower.hibernate") {
        return polkit.Result.YES;
    }
});


2. add localauthority files:

Code:
# cat /etc/polkit-1/localauthority/50-local.d/org.freedesktop.upower.pkla
[Local Users]
Identity=unix-group:wheel
Action=org.freedesktop.upower.*
ResultAny=yes
ResultInactive=no
ResultActive=yes
All users are part of the wheel group.

It doesn't make a difference if I replace "org.freedesktop.upower.suspend" with "org.freedesktop.login1.Manager".

Also, I get the following error, the code in powerdevil is poking the same values from dbus system bus, and hence concluding that suspend is not supported:

Code:
# qdbus --system org.freedesktop.UPower /org/freedesktop/UPower SuspendAllowed
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
Error: org.freedesktop.DBus.Error.AccessDenied
Rejected send message, 3 matched rules; type="method_call", sender=":1.47" (uid=0 pid=28705 comm="qdbus --system org.freedesktop.UPower /org/freedes") interface="(unset)" member="SuspendAllowed" error name="(unset)" requested_reply="0" destination="org.freedesktop.UPower" (uid=0 pid=27197 comm="/usr/lib/upower/upowerd ")

The strange thing is that I am calling this as root and it still shows error.AccessDenied. All methods show this error.

What the heck do I need to do to allow access to these methods in dbus?

<rant>
whoever did this disabling of suspend by default in dbus, did a great injustice to the public at large.
</rant>


Last edited by devsk on Mon Dec 09, 2013 4:05 am; edited 1 time in total
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sat Dec 07, 2013 11:20 pm    Post subject: Reply with quote

Is it not possible to get the suspend/hibernate working with KDE without using systemd as the init system instead of openrc? Right now, systemd is in USE and consolekit is not. Basically, everything is built with systemd but I am still running the system with openrc. Is anybody else using their gentoo like this?
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sat Dec 07, 2013 11:33 pm    Post subject: Reply with quote

Created a group called 'power' and added both root and the user to it. Still the same.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 2:32 am    Post subject: Reply with quote

Somebody here knows about the evil designs of systemd, dbus, consolekit (completely removed from my system), upower, udisks, udev, polkit and the ilk....:D And their interplay with suspend to RAM and disk.

Speak up my friend. A longtime Gentoo user is dying alone here.
Back to top
View user's profile Send private message
franzf
Advocate
Advocate


Joined: 29 Mar 2005
Posts: 4547

PostPosted: Sun Dec 08, 2013 9:11 am    Post subject: Reply with quote

3 bumps within 6 hours...Come one...

Concerning your problem: With USE="systemd -consolekit" and running openrc you miss one critical component for all that fancy features: session/user tracking. Either you have to enable USE="consolekit" or you must boot with systemd.
(BTW.: you also should not be able to mount your external drives through the device manager)
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 5:10 pm    Post subject: Reply with quote

I thought we needed USE=systemd to get newer udev, and systemd and consolekit were exclusive. I did not think USE="systemd consolekit" was possible at the time when I was updating some time ago. Does that work?
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 5:14 pm    Post subject: Reply with quote

franzf wrote:
3 bumps within 6 hours...Come one...
well, I was frustrated with this mess, so may be I went overboard. Sorry about that. Never been frustrated with gentoo before this. Ever.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 5:35 pm    Post subject: Reply with quote

franzf wrote:
Either you have to enable USE="consolekit" or you must boot with systemd.
Surprisingly, the system built with USE="systemd consolekit". I succinctly remember that it did not work earlier. Anyway, it built but still the same result.
franzf wrote:
(BTW.: you also should not be able to mount your external drives through the device manager)
Yeah, but I did not care about that much. I did care about laptop going to S3 sleep on lid close and shutting down on 3% battery etc.
Back to top
View user's profile Send private message
franzf
Advocate
Advocate


Joined: 29 Mar 2005
Posts: 4547

PostPosted: Sun Dec 08, 2013 6:14 pm    Post subject: Reply with quote

Did you start consolekit?
Code:
/etc/init.d/consolekit start

Might also require a restart of kdm/lightdm/...
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 7:35 pm    Post subject: Reply with quote

I actually rebooted after putting consolekit at default runlevel. Still no suspend/hibernate in powerdevil. The reason is that the powerdevil code is looking for either the presence of systemd version >= 195 and querying org.freedesktop.login1.Manager.CanSuspend from dbus or the presence of UPower API org.freedesktop.UPower.SuspendAllowed from system bus.

Now, the UPower API is deprecated:
Code:
# qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.SuspendAllowed
Error: org.freedesktop.UPower.GeneralError
Method is deprecated, please port to org.freedesktop.login1.Manager.CanSuspend

and of course, org.freedesktop.login1.Manager.CanSuspend won't work in the absence of systemd and its logind daemon, which come into existence only when I use systemd as init. The API is giving me AccessDenied but I think its most likely not finding anything registering org.freedesktop.login1 from UPower. I would have thought that if UPower deprecated an API, it would implement the new API.

Code:
# qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.login1.Manager.CanSuspend
Error: org.freedesktop.DBus.Error.AccessDenied
Rejected send message, 1 matched rules; type="method_call", sender=":1.40" (uid=0 pid=9732 comm="qdbus --system org.freedesktop.UPower /org/freedes") interface="org.freedesktop.login1.Manager" member="CanSuspend" error name="(unset)" requested_reply="0" destination="org.freedesktop.UPower" (uid=0 pid=9016 comm="/usr/lib/upower/upowerd ")

If I try to query from org.freedesktop.login1, I get:
Code:
# qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend
Error: org.freedesktop.DBus.Error.Spawn.ChildExited
Launch helper exited with unknown return code 1
not sure what that means. It does not give me a path which its failing to spawn. You got some ideas what it might be spawning?
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Sun Dec 08, 2013 10:51 pm    Post subject: Reply with quote

Finally, found the solution to my issues at https://bugzilla.redhat.com/show_bug.cgi?id=1005234

Wow! So many days wasted on this! All I needed to do was to build upower with -systemd (which passes --enable-deprecated to configure), add the polkit rules I added in post 1, made sure the perms on dir /etc/polkit-1 and /etc/polkit-1/rules.d were correct and it worked.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 2894
Location: Bay Area, CA

PostPosted: Mon Dec 09, 2013 4:03 am    Post subject: Reply with quote

While I was at it, I fixed the ability to mount and eject devices from the KDE's "Devices" icon in systray as well using a simple udisks2 policy kit rule file:

Code:
# cat /etc/polkit-1/rules.d/00-udisks.rules
polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.udisks2.filesystem-mount" ||
        (action.id == "org.freedesktop.udisks2.eject-media")) &&
        subject.isInGroup("disk")) {
        return polkit.Result.YES;
    }
});
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum