Polkit requesting root password to suspend after updating from version 0.112 to 0.113

A few days ago, polkit version 0.113 was marked stable on Gentoo amd64. Since the update, I could no longer suspend my system without entering the root password. Quite annoying, especially for a laptop.

When canceling the polkit dialog, this appeared in the journal (yes, I am using systemd):

sep 10 05:22:52 sylvester.nomad.adlevio.net polkitd[18113]: Operator of unix-session:3 FAILED to authenticate to gain authorization for action org.freedesktop.login1.suspend for system-bus-name::1.96 [kded5 [kdeinit5]] (owned by unix-user:stijn)

While I don't think this is something I should be fixing manually on a modern desktop system, I just wanted a quick fix and be done with it. Turned out to be easy. Just adding a file /etc/polkit-1/rules.d/85-suspend.rules with this content fixed it:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" &&
        subject.isInGroup("users")) {
        return polkit.Result.YES;
    }
});

Cheers

Tags: 

Topics: