xfce4-power-manager issues

joplass

Active Member

Reaction score: 15
Messages: 147

I installed xfce4-power-manager after installing FreeBSD 12.1-RELEASE. At first the slider for suspend/hibernate was not moving "Hibernate and suspend operations not permitted" when started as a user. So I set up sudo and the slider was working when started from terminal with sudo. Suspend worked on and off but all of a sudden even with sudo the slider is gray-out with "Hibernate and suspend blah blah". While searching the forum I found solutions that worked, I believe for some people. Below are changes made so far based on advises from the forum:

Code:
$ xfce4-power-manager --dump
---------------------------------------------------
       Xfce power manager version 1.6.5
With policykit support
Without network manager support
---------------------------------------------------
Can suspend: True
Can hibernate: True
Authorized to suspend: False
Authorized to hibernate: False
Authorized to shutdown: False
Has battery: False
Has brightness panel: False
Has power button: True
Has hibernate button: False
Has sleep button: True
Has battery button: True
Has LID: True
I would like to have "Authorized to suspend: True" and "Authorized to hibernate: True".

/usr/local/etc/polkit-1/rules.d/50-default.rules

Code:
polkit.addRule(function (action, subject) {
  if ((action.id == "org.freedesktop.consolekit.system.restart" ||
      action.id == "org.freedesktop.consolekit.system.stop")
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});

For those who have working suspend/resume:

polkit.addRule(function (action, subject) {
  if (action.id == "org.freedesktop.consolekit.system.suspend"
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});
Code:
$ sysctl hw.acpi.supported_sleep_state
hw.acpi.supported_sleep_state: S3 S4 S5
I will appreciate some help. I do believe changing these "Authorized to suspend: True" and "Authorized to hibernate: True" is key but I could be wrong.

Regards,
 

Elazar

Well-Known Member

Reaction score: 140
Messages: 345

I wonder if you could just delete the part "&& subject.isInGroup("operator")".
 

genneko

Member

Reaction score: 13
Messages: 42

Hi!
Doesn't the following line in your 50-default.rules have to be a comment (starting with //)?
Code:
For those who have working suspend/resume:
If this is the case, you would see the following error in /var/log/auth.log.
Code:
polkitd[xxxx]: Error compiling script /usr/local/etc/polkit-1/rules.d/xxxx.rules
I have had a similar problem when I used # for comments and it caused the error.
 
OP
J

joplass

Active Member

Reaction score: 15
Messages: 147

Thanks for your replies. I tried both solutions and re-started the machine with no change. I will keep working on it.
 

mark_j

Aspiring Daemon

Reaction score: 329
Messages: 641

I have .isInGroup set to "wheel" and it works fine.
I created a file, 60-local.rules and plonked this in:
Code:
    polkit.addRule(function (action, subject) {
      if ((action.id == “org.freedesktop.consolekit.system.restart” ||
          action.id == “org.freedesktop.consolekit.system.stop”)
          && subject.isInGroup(“wheel”)) {
        return polkit.Result.YES;
      }
    });

    polkit.addRule(function (action, subject) {
      if (action.id == “org.freedesktop.consolekit.system.suspend”
          && subject.isInGroup(“wheel”)) {
        return polkit.Result.YES;
      }
    });
 
Top