1

I'm on Slackware current usingd elogind, I can sleep and hibernate only using sudo from terminal. With the old good pm-utils I had only to edit the 10-enable-suspend.rules, make init 3 && init 4 and I can hibernate as user. Now I make those steps

a)copying the two polkit rules

cp /usr/share/polkit-1/rules.d/10-enable-* /etc/polkit-1/rules.d/

b)I add my user in power group

usermod -aG power myuser

c)in logind.conf I had those options enabled

grep -v ^# /etc/elogind/logind.conf

[Login]
HandlePowerKey=poweroff
HandleHibernateKey=hibernate
HandleLidSwitch=hibernate

[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=yes

d) I reboot the system

reboot

And from xfce4-power-manager I cannot hibernate or sleep.

I tried also from cli

$ loginctl hibernate
$ echo $?
1

1 Answer 1

0

Solution found.

a)I have created 3 files, one for brightness, one for suspend, one for hibernate

/etc/polkit-1/rules.d/88-suspend.rules
/etc/polkit-1/rules.d/88-hibernate.rules
/etc/polkit-1/rules.d/89-backlight.rules

b) the contents of files: I assign to the group power the possibility to decrease brightness, suspend and hibernate the os, of course your user must be in the group power(as secondary or primary)

cat /etc/polkit-1/rules.d/88-hibernate.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.hibernate" &&
        subject.isInGroup("power")) {
        return polkit.Result.YES;
    }
});


cat /etc/polkit-1/rules.d/88-suspend.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" &&
        subject.isInGroup("power")) {
        return polkit.Result.YES;
    }
});


cat /etc/polkit-1/rules.d/89-blacklight.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.xfce.power.backlight-helper" &&
        subject.isInGroup("power")) {
        return polkit.Result.YES;
    }
});

c)restart power-manager

xfce4-power-manager --restart

Tested and works fine from xfce4 gui and loginctl command line

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .