Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Asking for authentication on automatic suspend on XFCE

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
andoru
Posts: 272
Joined: 2014-03-14 16:59

Asking for authentication on automatic suspend on XFCE

#1 Post by andoru »

So, I've been having issues with automatic suspend-to-RAM on my XFCE machines. One doesn't do this automatically, and when I log into my account (light-locker), I get prompted for a password in order to suspend. The other machine on which I have issues is when I have multiple users logged in, and the PC is supposed to suspend, I also get an authentication prompt. If need-be, I'll also post the outputs from that machine.
So I've found this useful post on XFCE forums.
I followed along with the thread, and here are the relevant outputs I got:

Code: Select all

$ groups
andoru cdrom floppy sudo audio dip video plugdev vboxusers netdev

Code: Select all

$ cat /etc/systemd/logind.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
HandlePowerKey=suspend
HandleSuspendKey=suspend
HandleHibernateKey=hibernate
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=ignore
HandleRebootKey=reboot
PowerKeyIgnoreInhibited=no
SuspendKeyIgnoreInhibited=no
HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodes=400k
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

Code: Select all

# journalctl --no-pager -u polkit | grep FAILED
[...]
Feb 11 01:34:22 polkitd(authority=local)[598]: Operator of unix-session:2 FAILED to authenticate to gain authorization for action org.freedesktop.login1.suspend for system-bus-name::1.35 [xfce4-power-manager] (owned by unix-user:andoru)
Feb 12 21:11:59 polkitd(authority=local)[598]: Operator of unix-session:2 FAILED to authenticate to gain authorization for action org.freedesktop.login1.suspend for system-bus-name::1.35 [xfce4-power-manager] (owned by unix-user:andoru)
Feb 13 05:12:42 polkitd(authority=local)[598]: Operator of unix-session:2 FAILED to authenticate to gain authorization for action org.freedesktop.login1.suspend for system-bus-name::1.35 [xfce4-power-manager] (owned by unix-user:andoru)
Seeing as I had the same output as the guy in the thread, I followed the instructions on the linked article
Then I looked at how I should make polkit rules on Debian, and made this file:

Code: Select all

$ cat /usr/share/polkit-1/rules.d/10-suspend.rules 
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" &&
        subject.isInGroup("users")) {
        return polkit.Result.YES;
    }
});
But still I get that authentication prompt, even after a complete restart.
What gives? Is there something I'm missing?

I've also tried killing light-locker as was instructed in the thread linked above, and it did seem to want to suspend without password confirmation, but this time I got this message:
Image
So it still wouldn't suspend automatically, when it's actually supposed to... aside for the blow to security.

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#2 Post by andoru »

Alright.
So now that I started light-locker again, and lowered the power saving setting to 15 minute, it finally would suspend the machine. The only problem is that it would suspend while just watching a longer video in VLC... (which is NOT what it's supposed to do)
After fiddling with the power setting, and placing it on 30 minutes, the PC refuses to suspend without root password, AGAIN!
Same thing that asks me for a password pops up again...
This is really frustrating. Why can't I have some properly working power saving settings without having to fiddle with everything...?

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#3 Post by andoru »

After some more time with no solution to this, I noticed that if I watch longer videos that 30 min, either through VLC, any other media player or through HTML5 in a browser, the PC magically suspends automatically. EXACTLY when it's not supposed to!

Any input on where I could try to look next so I could fix this annoying issue?

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Asking for authentication on automatic suspend on XFCE

#4 Post by CwF »

The VLC question has been answered a few times over on forum.xfce.org I believe.

I don't use VLC, or suspend stuff, so...

Debian doesn't seem to agree with most googled results. Instead of the /usr/share/polkit-1/rules.d/10-suspend.rules method you may try /etc/polkit-1/localauthority/50-local.d/10-suspend.pkla

Code: Select all

[User Permissions]
Identity=unix-user:andoru;
Action=org.freedesktop.login1.suspend
ResultActive=yes
check your progress;

Code: Select all

pkcheck --process $$ --action-id org.freedesktop.login1.suspend --allow-user-interaction (--enable-internal-agent)
.try with and w/o --enable-internal-agent
check the expectation;

Code: Select all

$ pkaction --verbose --action-id org.freedesktop.login1.suspend
org.freedesktop.login1.suspend:
  description:       Suspend the system
  message:           Authentication is required for suspending the system.
  vendor:            The systemd Project
  vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
  icon:              
  implicit any:      auth_admin_keep
  implicit inactive: auth_admin_keep
  implicit active:   yes

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#5 Post by andoru »

Thank you for the reply!
Unfortunately that hasn't changed anything, I still get the prompt for authentification and it still doesn't suspend.
Here's the output for the last command you gave:

Code: Select all

$ pkaction --verbose --action-id org.freedesktop.login1.suspend
org.freedesktop.login1.suspend:
  description:       Suspend the system
  message:           Authentication is required to suspend the system.
  vendor:            The systemd Project
  vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
  icon:              
  implicit any:      auth_admin_keep
  implicit inactive: auth_admin_keep
  implicit active:   yes

So basically it's the same output as yours.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Asking for authentication on automatic suspend on XFCE

#6 Post by CwF »

Use the pkcheck to trace the authority. This is different among versions. I'd guess the issue is a mismatch in versions of all the elements...

Code: Select all

$  pkcheck --process $$ --action-id org.freedesktop.login1.suspend --allow-user-interaction
If this simply returns nothing, that is success = the action would have proceeded. If there is a need for further action (your password prompt) then it will return a message.

One oddity is what user agent you have running and why it's interrupting. You don't need an agent to step in for the password, so why is it? I don't have one installed. With a pkla rule you don't need one. pkcheck should show the issue.

Dump VLC! MPV is better!

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#7 Post by andoru »

The command doesn't return any output, same when used with --enable-internal-agent at the end.
CwF wrote: One oddity is what user agent you have running and why it's interrupting. You don't need an agent to step in for the password, so why is it? I don't have one installed. With a pkla rule you don't need one. pkcheck should show the issue.
How could I find that? Searching around I could only find things about mail user agent which I'm assuming is not what I'm looking for.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Asking for authentication on automatic suspend on XFCE

#8 Post by CwF »

andoru wrote:The command doesn't return any output
good, it's not directly a polkit permission issue.

Code: Select all

$   dpkg --get-selections | grep agent
libpolkit-agent-1-0:amd64			install

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#9 Post by andoru »

I get this:

Code: Select all

$ dpkg --get-selections | grep agent
gnupg-agent					install
gpg-agent					install
libpolkit-agent-1-0:amd64			install
libpolkit-agent-1-dev				install
So I'll try removing the gpg agents and see if this fixes it.

CwF
Global Moderator
Global Moderator
Posts: 2638
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Asking for authentication on automatic suspend on XFCE

#10 Post by CwF »

andoru wrote:So I'll try removing the gpg agents and see if this fixes it.
No, you're fine.
The agent to remove if any would have been a DE agent from gnome or other. You may not need the dev package, but nothing wrong there.
I don't know where else to point you!?

andoru
Posts: 272
Joined: 2014-03-14 16:59

Re: Asking for authentication on automatic suspend on XFCE

#11 Post by andoru »

Thank you for helping out still!
If this weren't to happen on another machine as well, I would've went the route of reinstalling the OS.

Post Reply