Bug 1005234

Summary: Suspend / Hibernate don't work in MATE on fedora 20
Product: [Fedora] Fedora Reporter: Dan Mashal <dan.mashal>
Component: mate-session-managerAssignee: Dan Mashal <dan.mashal>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 20CC: christoph.wickert, dan.mashal, fedora, funtoos, gregor, rdieter, stefano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mate-session-manager-1.6.1-3.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-22 23:55:39 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 Dan Mashal 2013-09-06 13:34:49 UTC
Can't suspend or hibernate on Fedora 20 with Light DM, 1.7

Reporting this as it's not already reported.

Comment 1 Dan Mashal 2013-09-06 13:35:41 UTC
Steps to reproduce:

1) Install MATE Desktop or Cinnamon

2) Go to system -> shutdown -> no option to hibernate or standby

Comment 2 Rex Dieter 2013-09-06 15:35:42 UTC
Oh, you mean suspend/hibernate doesn't work when logged into mate or cinnamon, when using lightdm?

I can suspend/hibernate just fine from lightdm-gtk itself.

Comment 3 Rex Dieter 2013-09-06 15:36:50 UTC
At least, how I tested, was installing f20-alpha-tc4 kde live image, then

yum install lightdm-gtk
systemctl enable lightdm --force

reboot, suspend options show and work in lightdm-gtk greeter menu.

Comment 4 Rex Dieter 2013-09-06 15:39:06 UTC
And, as a bonus, I can suspend from within my kde session, logged in from lightdm too.

Comment 5 Rex Dieter 2013-09-06 17:30:04 UTC
tested gnome too.

Now, tried sddm + mate session, still no suspend.

Pretty sure this is not a lightdm issue, reassigning to mate-power-manager for now.

Comment 6 Wolfgang Ulbrich 2013-09-06 18:46:27 UTC
Rex, i'm pretty shure you forgot to update this report.
This bug affected all DE's (mate, cinnamon, xfce, gnome, etc), what is confirmed by me and Leigh for cinnamon, so it has nothing to do with mate-power-manager.
To be clarify this issue:
Suspend/hibernate from inside lightdm works fine in f20.
But it doesn't work from inside any DE exept KDE which use qdbus commands for suspend/hibernate.

Comment 7 Rex Dieter 2013-09-06 18:52:10 UTC
Fwiw, I tested gnome, and it worked for me (closing lid), there's apparently no UI way without using an extention.

Since,
qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.feedesktop.login1.Manager.CanSuspend

returned 'yes', for me, in the MATE session, I can only conclude, based on the evidence so far, that mate-power-manager methods for checking this over dbus aren't working for whatever reason.

Comment 8 Rex Dieter 2013-09-06 18:54:22 UTC
and, checking just now, in xfce, xfce4-power-manager shows suspend/hibernate options (that work as advertised), for me.

Comment 9 Rex Dieter 2013-09-06 19:06:11 UTC
testing Cinnamon, assuming it is supposed to show suspend option from the menu near or with either Quit or Leave , then I can confirm it doesn't work either.

Comment 10 Wolfgang Ulbrich 2013-09-06 19:08:46 UTC
(In reply to Rex Dieter from comment #7)
> Fwiw, I tested gnome, and it worked for me (closing lid), there's apparently
> no UI way without using an extention.
Suspend on lid close works also in MATE, but i see no suspend/hibernate in gnome/cinnamon logout popup window.
> 
> Since,
> qdbus --system org.freedesktop.login1 /org/freedesktop/login1
> org.feedesktop.login1.Manager.CanSuspend
> 
> returned 'yes', for me, in the MATE session, I can only conclude, based on
> the evidence so far, that mate-power-manager methods for checking this over
> dbus aren't working for whatever reason.

In the end i can solve this issue with adding command and desktop-file for

dbus-send --system --print-reply --dest="org.freedesktop.login1" /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true

for mate menus if nothing helps.

Comment 11 Wolfgang Ulbrich 2013-09-06 19:11:34 UTC
(In reply to Rex Dieter from comment #9)
> testing Cinnamon, assuming it is supposed to show suspend option from the
> menu near or with either Quit or Leave , then I can confirm it doesn't work
> either.

I don't thing that cinnamon shows this in the menu normaly, it's like in mate that a window pop up which shows this options.

Comment 12 Wolfgang Ulbrich 2013-09-06 19:12:01 UTC
~think

Comment 13 Rex Dieter 2013-09-06 19:12:10 UTC
OK, I can confirm Cinnamon lid close=>suspend  works too.

So, IMO, we're down to what appears to be a bug in the mate/cinnamon UI's not showing the suspend (and friends) options properly.

Comment 14 Wolfgang Ulbrich 2013-09-06 19:25:52 UTC
agree with mate/cinnamon/gnome.
I'm still wondering that it works now in xfce because it was definitely not working some weeks ago on my system, maybe cwickert knows about a change in xfce.

Comment 15 Dan Mashal 2013-09-07 03:57:22 UTC
This is confusing since nothing changed (afaik) from Fedora 19 -> 20. Just lightdm.

Does this still work on F19?

Wolfgang, I guess the only way to resolve this is with the patch you mentioned and we should submit that patch upstream.

Comment 16 Wolfgang Ulbrich 2013-09-07 11:48:27 UTC
(In reply to Dan Mashal from comment #15)
> This is confusing since nothing changed (afaik) from Fedora 19 -> 20. Just
> lightdm.
> 
> Does this still work on F19?

In f19 everthing works fine.
> 
> Wolfgang, I guess the only way to resolve this is with the patch you
> mentioned and we should submit that patch upstream.
This is the last solution for me if anything else helps, and can be done very quickly.

After talking with Stefano, suspend and hybernate are handled from mate-session-manager, which use ck and systemd.
There is a check for upower inside the code for hybernate/suspend.
But systemd and upower was working fine together until f20.

Comment 17 Rex Dieter 2013-09-07 14:46:19 UTC
ah, that's the problem.  Remember, upower is deprecated for this purpose.  As a matter of fact, no longer works in f20:

$ qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.CanSuspend

false

$ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend

yes

Comment 18 Rex Dieter 2013-09-07 15:08:18 UTC
Interestingly, found UPower.SuspendAllowed method.

On f20:

$ 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

On f19:

$ qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.SuspendAllowed

true


Digging more, according to,
http://upower.freedesktop.org/docs/UPower.html

Seems my prior interpretation of UPower.CanSuspend was incorrect.  It only checks if the system supports suspend, not whether it's allowed by policy.  The policy check is SuspendAllowed

login1's CanSuspend does both:
http://www.freedesktop.org/wiki/Software/systemd/logind/
"CanPowerOff(), CanReboot(), CanSuspend(), CanHibernate(), CanHybridSleep() tests whether the system supports the respective operation and whether the calling user is eligible for the desired operation."


So long and short of it is that basically still can't rely on UPower here, need to use systemd-login1 native calls to make this work right.

Comment 19 Wolfgang Ulbrich 2013-09-07 15:11:10 UTC
With a huge help from infirit our friend from gentoo we could track down the issue. It is upower related.
mate-session-manager needs upower for suspend and friends. See
https://github.com/mate-desktop/mate-session-manager/blob/master/mate-session/gsm-manager.c#L3190
https://github.com/mate-desktop/mate-session-manager/blob/master/mate-session/gsm-manager.c#L1106
http://git.mate-desktop.org/mate-session-manager/tree/mate-session/gsm-logout-dialog.c#n200

But upower-0.9.21 is build without --enable-deprecated configure flag and runtime require pm-utils for f20.
A rebuild with that flag gives me the suspend/hibernation option back.
Tested with mate/cinnamon/xfce, only in gnome-3 i have no suspend/hibernation options.
koji scratch build for testing.
http://koji.fedoraproject.org/koji/taskinfo?taskID=5907874

Comment 20 Wolfgang Ulbrich 2013-09-07 15:23:19 UTC
Seems like we spoken about the same :)

Comment 21 Rex Dieter 2013-09-07 15:36:03 UTC
The better/long-term fix is to simply port to use the proper org.freedesktop.login1 methods, and not rely on deprecated upower stuff, imho.

Comment 22 Fedora Update System 2013-09-10 14:19:48 UTC
mate-session-manager-1.6.1-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mate-session-manager-1.6.1-3.fc20

Comment 23 Fedora Update System 2013-09-10 16:22:44 UTC
Package mate-session-manager-1.6.1-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mate-session-manager-1.6.1-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-16262/mate-session-manager-1.6.1-3.fc20
then log in and leave karma (feedback).

Comment 24 Dan Mashal 2013-09-11 08:54:39 UTC
Thanks Rex

Comment 25 Fedora Update System 2013-09-22 23:55:39 UTC
mate-session-manager-1.6.1-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 26 devsk 2013-12-08 22:47:38 UTC
Ah...I finally found the solution to my problems on Gentoo. Thank you so much Wolfgang!

I am basically running Gentoo with openrc as init and I had tough time figuring out why suspend was not allowed. My debugging/comments/rants at:

http://forums.gentoo.org/viewtopic-p-7457320.html