Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kde5 - cannot suspend or hibernate [solved]
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
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Mon Sep 28, 2015 9:07 pm    Post subject: kde5 - cannot suspend or hibernate [solved] Reply with quote

Hello,
I just installed plasma-meta. There were some issues after installation (root password required for mounting flash drives), I was able to handle them by myself.

I have last (for now) issue and I cannot figure it out. Problem is with suspending or hibernating using standard KDE way. Suspend or hibernation don't work at all, only screen locks, but computer is still running.
I suppose it's a permissions problem:
Code:

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
Error org.freedesktop.UPower.GeneralError: not authorized


I can suspend or hibernate using pm-suspend/pm-hibernate, but I need the standard way because it's laptop and I need to suspend it after closing lid.

I thought it's polkit issue and I tried to evade it by creating /etc/polkit-1/rules.d/51-upower.rules
Code:

polkit.addRule(function(action, subject) {
  var YES = polkit.Result.YES;
  var permission = {
    "org.freedesktop.UPower.Suspend": YES,
    "org.freedesktop.UPower.Hibernate": YES,
  };
  return permission[action.id];
});

But that doesn't fix that, problem is still the same.

Can somebody help me with that? It's quite critical feature for me...
I should probably mention that I'm using Funtoo now, not vanilla Gentoo, but I hope it's not a problem.

Thanks.


Last edited by pechy on Thu Oct 01, 2015 8:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6824
Location: Austria

PostPosted: Mon Sep 28, 2015 9:48 pm    Post subject: Reply with quote

How do you login to your plasma session?
Do you use openrc? Is consolekit started? Is your user part of 'users' group?
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Mon Sep 28, 2015 11:28 pm    Post subject: Reply with quote

I use sddm as displaymanager, defined in /etc/conf.d/xdm. I added xdm to default runlevel by rc-update.
Consolekit and even Polkit is running
Code:

 4369 ?        Sl     0:00 /usr/sbin/console-kit-daemon --no-daemon
 3991 ?        Sl     0:00 /usr/lib/polkit-1/polkitd --no-debug
 6908 ?        Sl     0:00 /usr/lib64/libexec/polkit-kde-authentication-agent-1

I had issues with not working NetworkManager after login, so I used some ugly hack found somewhere and removed nox11 from pam_ck_connector.so line /etc/pam.d/system-login. Without that, I wasn't even registered by consolekit.
Now I see myself in
Code:

# ck-list-sessions
Session4:
        unix-user = '1000'
        realname = '(null)'
        seat = 'Seat5'
        session-type = ''
        active = FALSE
        x11-display = ':0'
        x11-display-device = ''
        display-device = ''
        remote-host-name = ''
        is-local = TRUE
        on-since = '2015-09-28T21:13:17.279157Z'
        login-session-id = '4'

so I think I'm now seen by consolekit correctly.

I had also some issues with udisks2, which wanted root password for mounting flash drives, so I overrided it by (also found on some forum):
Code:

# cat /etc/polkit-1/rules.d/50-udisks.rules
polkit.addRule(function(action, subject) {
  var YES = polkit.Result.YES;
  var permission = {
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.filesystem-mount-system": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": YES,
  };
  if (subject.isInGroup("storage")) {
    return permission[action.id];
  }
});

It works after that. I don't like using these ugly hacks, but the system was not usable without it (and I didn't know the correct solution).

I tried to do something similar for upower, but it isn't working. If you can say me what I'm doing wrong (and how to do it correct, not this ugly hacking way), I would be glad.
But most critical thing for me now is the upower/suspend thing. My laptop already run out of battery, because I didn't noticed it's still running after closing the lid.... I still think that main reason is some permissions problem:
Code:

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
Error org.freedesktop.UPower.GeneralError: not authorized


Thanks for helping :)
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6824
Location: Austria

PostPosted: Mon Sep 28, 2015 11:31 pm    Post subject: Reply with quote

genstorm wrote:
Is your user part of 'users' group?

_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Mon Sep 28, 2015 11:57 pm    Post subject: Reply with quote

sorry, I forgot this part...
Code:

$ groups
wheel audio video users plugdev storage

so, yes
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6824
Location: Austria

PostPosted: Mon Sep 28, 2015 11:59 pm    Post subject: Reply with quote

Hm, strange, but it's entirely possible your ugly hacks are interfering. This is bad:
pechy wrote:
active = FALSE

sddm is built with USE=consolekit?
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Tue Sep 29, 2015 10:57 am    Post subject: Reply with quote

Ok, I discovered sddm was not build with USE="consolekit", I rebuild it with that (there is another issue, that sddm-0.12.0 with +consolekit depens on >=sys-auth/consolekit-0.9.4, which is currently masked in Funtoo - I will probably report that later).
Now I have working sddm with consolekit, I removed one ugly hack in /etc/pam.d/system-login - added nox11 there again (btw that was recommended way to integrate previus version of sddm with consolekit.
But suspend still doesn't work.
Also the ck-list sessions slightly changed (there is also is-local=FALSE, but problematic active=FALSE is still there):
Code:

$ ck-list-sessions
Session1:
        unix-user = '1000'
        realname = '(null)'
        seat = 'Seat2'
        session-type = ''
        active = FALSE
        x11-display = ':0'
        x11-display-device = '/dev/tty7'
        display-device = ''
        remote-host-name = ''
        is-local = FALSE
        on-since = '2015-09-29T09:59:00.439548Z'
        login-session-id = '1'


Output from dbus-send also changed, it now doesn't look like permission problem, but still it's not fixed:
Code:

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
method return sender=:1.7 -> dest=:1.39 reply_serial=2

it looks like something now happens, network disconnects and reconnects again, but screen does'n turn off, nothing more. Also the .xsessions-error (imho) suggests, that system tried to suspend and immediatelly waked up???:
Code:

(only new lines in file after running dbus-send...)
Time engine Clock skew signaled
kscreen.kded: Resumed from suspend, checking for screen changes
kscreen: Primary output changed from KScreen::Output(Id: 67 , Name: "eDP1" ) ( "eDP1" ) to KScreen::Output(Id: 67 , Name: "eDP1" ) ( "eDP1" )
Currrent active notifications: QHash()
Guessing partOf as: 0
 New Notification:  "DHCP" "Connection 'DHCP' deactivated." -1 & Part of: 0
Currrent active notifications: QHash(("notification 22", "Network managementDHCP"))
Guessing partOf as: 22
 New Notification:  "DHCP" "Connection 'DHCP' activated." -1 & Part of: 22

pm-suspend still working well...

I'm really confused with this.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6824
Location: Austria

PostPosted: Tue Sep 29, 2015 11:09 am    Post subject: Reply with quote

Well, I have no idea about the state of consolekit/sddm in funtoo.
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Tue Sep 29, 2015 11:22 am    Post subject: Reply with quote

it should be about the same as in gentoo. sddm is directly from portege tree, consolekit is custom version, but It doesn't look like permissions issue for me now.
If I close the lid now, I even see some messages in .xsession-errors from powerdevil:
Code:

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
lock called
kscreen.kded: System is going to suspend, won't be changing config (waited for  1001 ms)
Lock window Id:  31457307
CreateNotify: 31457307
CreateNotify: 58720258
CreateNotify: 58720260
CreateNotify: 58720264
CreateNotify: 58720266
Skipped method "moduleDeleted" : Pointers are not supported: KDEDModule*
kcm_keyboard: Fetched layout groups from X server:      layouts: ("cz", "us")   variants: ("", "")
kcm_keyboard: Fetched layout groups from X server:      layouts: ("cz", "us")   variants: ("", "")
CreateNotify: 58720267
MapNotify: 58720267
MapNotify: 31457307
CreateNotify: 58720271
Time engine Clock skew signaled
kscreen.kded: Resumed from suspend, checking for screen changes
kscreen: Primary output changed from KScreen::Output(Id: 67 , Name: "eDP1" ) ( "eDP1" ) to KScreen::Output(Id: 67 , Name: "eDP1" ) ( "eDP1" )
Currrent active notifications: QHash()
Guessing partOf as: 0
 New Notification:  "DHCP" "Connection 'DHCP' deactivated." -1 & Part of: 0
CreateNotify: 40035819
MapNotify: 40035819
UnmapNotify: 41943088
Unknown toplevel for MapNotify
UnmapNotify: 40035819
Currrent active notifications: QHash()
Guessing partOf as: 0
 New Notification:  "DHCP" "Connection 'DHCP' activated." -1 & Part of: 0
CreateNotify: 40036339
MapNotify: 40036339
UnmapNotify: 58720267
UnmapNotify: 58720267
CreateNotify: 58720273
QXcbConnection: XCB error: 3 (BadWindow), sequence: 53270, resource id: 58720273, major code: 18 (ChangeProperty), minor code: 0
Grab Released

It's preparing to suspend, but the suspend did not happen at all or suspend is immediatelly interupted by someting... The question is why, I don't see anything really suspicious in .xsession-errors...
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Tue Sep 29, 2015 1:28 pm    Post subject: Reply with quote

ok, discovered something, when I try to suspend for the first time after login, it also logs
Code:

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
...
kscreen.kded: System is going to suspend, won't be changing config (waited for  1001 ms)
...
powerdevil: fd passing available: true
powerdevil: systemd powersave events handling inhibited, descriptor: 32
kscreen.kded: Resumed from suspend, checking for screen changes
...
Grab Released

could that line powerdevil: systemd powersave events handling inhibited, descriptor: 32 cause this issues? I don't even (and I don't like to) have systemd installed...
If so, can I repair (or hack somehow, I don't mind at this moment) this?
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 381
Location: Paris

PostPosted: Tue Sep 29, 2015 4:41 pm    Post subject: Reply with quote

try to use upower-pm-utils instead of upower
referring to
https://wiki.gentoo.org/wiki/KDE/Plasma_5_upgrade#Missing_shutdown.2C_reboot.2C_suspend_and_hibernate_buttons_when_using_OpenRC
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Tue Sep 29, 2015 8:03 pm    Post subject: Reply with quote

I have upower-pm-utils (not upower) installed - it's also dependency of powerdevil, sddm and more. I don't have upower installed.
After hours of debugging I'm quite convinced, that's issue with upower/powerdevil, not permissions. It's quite interesting with consolekit also, but I don't think it's causing this...

I have sddm installed with USE="consolekit", if I left nox11 option in /etc/pam.d/system-login, in ck-list-sessions I see one session with active=FALSE. If I remove nox11, I get two sessions in ck-list-sessions (quite as expected) and one of them has active=TRUE. It looks that sddm creates consolekit sessions by itself, but it doesn't set it active. Only the session from pam_ck_connector.so from pam is active. When I build sddm with USE="-consolekit" and remove nox11 option, I get one session (again as expected), but it's not active. Seriously, I don't get it...

Now I've got new interesting set of messages in .xsession-errors:
Code:

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
kscreen.kded: Resumed from suspend, checking for screen changes
...


When I try to suspend by command (dbus-send...), I don't get any permissions warning, still it looks like it prepares for suspend and immediately resuming from suspend.
At this moment, I have no idea what else to try.

Can someone with working suspend on kde-plasma post for me log from .xsession-errors, what should normally be logged on suspend? Maybe I could at least compare and find what's missing...
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 381
Location: Paris

PostPosted: Wed Sep 30, 2015 10:28 am    Post subject: Reply with quote

I have no problem in suspend. here is what you want form .xsession-error

Quote:
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
lock called
kscreen.kded: System is going to suspend, won't be changing config (waited for 1001 ms)
Lock window Id: 23068698
CreateNotify: 23068698
CreateNotify: 62914562
CreateNotify: 62914564
CreateNotify: 62914568
CreateNotify: 62914570
Skipped method "moduleDeleted" : Pointers are not supported: KDEDModule*
kcm_keyboard: Fetched layout groups from X server: layouts: ("us") variants: ("")
kcm_keyboard: Fetched layout groups from X server: layouts: ("us") variants: ("")
CreateNotify: 62914571
MapNotify: 62914571
MapNotify: 23068698
CreateNotify: 62914575
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Metered"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Metered"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Metered"
plasma-nm: virtual void SecretAgent::DeleteSecrets(const NMVariantMapMap&, const QDBusObjectPath&)
plasma-nm: Path: "/org/freedesktop/NetworkManager/Settings/2"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Metered"
networkmanager-qt: void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap&) Unhandled property "Devices"
networkmanager-qt: void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap&) Unhandled property "Devices"
Time engine Clock skew signaled
powerdevil: Kbd backlight brightness value: 0
powerdevil: set kbd backlight value: 0
Back to top
View user's profile Send private message
pechy
n00b
n00b


Joined: 04 Aug 2015
Posts: 9

PostPosted: Thu Oct 01, 2015 8:32 pm    Post subject: Reply with quote

Hello,
thanks for that log. Finally, today I found solution.
It's quite embarasing, but it was my fault, one of my ugly hacks. Some time ago I created hook for pm-utils (I forgot it since then). It returned error, when pm-utils was not run directly, but through upower. Error in that hook caused pm-utils to inhibit sleep. And that's the whole story...

So, no problems with packages, at least that is good news.

Thanks for trying to help me and sorry for bothering with this.
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