One somewhat annoying change in Gnome 3 is the fact that Power Off is not exposed to the end-user unless suspend and hibernate are not available. If suspend does not work for some reason (buggy hardware), there is no easy way to disable it.
Recently suggestions to edit /usr/share/polkit-1/actions/org.freedesktop.upower.policy have started circulating the blogosphere.
Unfortunately editing anything under /usr/share is a bad idea: the changes will be silently overwritten by the next package update (upower for this particular file).
Thus we need something more permanent.
First let us list all possible action keys:
# pkaction | grep upower
org.freedesktop.upower.hibernate org.freedesktop.upower.qos.cancel-request org.freedesktop.upower.qos.request-latency org.freedesktop.upower.qos.request-latency-persistent org.freedesktop.upower.qos.set-minimum-latency org.freedesktop.upower.suspend
Oviously the ones we need to deny access to are the ones named suspend and hibernate
To do that, we have to create a new configuration file under /etc/polkit-1/localauthority
# vi /etc/polkit-1/localauthority/50-local.d/50-disable-suspend.pkla
And copy the following code into that file:
[Disable Suspend] Identity=unix-user:* Action=org.freedesktop.upower.hibernate;org.freedesktop.upower.suspend ResultAny=no ResultInactive=no ResultActive=no
Finally check that the permission was successfully revoked
$ pkcheck --action-id org.freedesktop.upower.suspend --process $$
Not authorized.
If you get no output from the pkcheck command (make sure to run it as a normal user not root) the permission is still there.
That’s it, after re-login the annoying Suspend will be replaced by a friendly Power Off 🙂
Enojy!
[…] Fortunately folks older and more into the inner workings of this stuff than me have a better, permanent, solution; so head on over to Anttix’s blog for a correct solution. […]
[…] Disable suspend by following these instructions […]