HOWTO: Disable Suspend and Hibernate – Ubuntu
For some people, such as myself, the suspend/hibernate features in Ubuntu cause trouble, in my case, a lockup, or just general misbehaviour of the system. And in the power menu, it’s all too easy to click one instead of another. So it makes sense to disable the features from the power menu. The idea for this post, and the method for Ubuntu 10.04 comes from this thread over on UF.
Ubuntu 10.04
Open a Terminal from Applications>Accessories>Terminal. Type in the following, and hit enter. When prompted, provide your password
gksudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy
There are two sections in this file, the first for suspend and the second for hibernate. Near the end of each section will be a line with:
<allow_active>yes</allow_active>
Change this entry from “yes” to “no” to disable hibernate/suspend.
<allow_active>no</allow_active>
Ubuntu 9.10
The only difference between the process for 10.04 and 9.10 is the location of the file. Use the following line instead to open the file.
gksudo gedit /usr/share/polkit-1/actions/org.freedesktop.devicekit.power.policy
That’s it! The hibernate and suspend options will no longer be shown in the power menu in Gnome, so no more accidental lockups for you!
Or me… 😉
Filed under: HowTo, Posts, Ubuntu | 19 Comments
Tags: HowTo, Linux, Ubuntu
Does this also disable the XF86Sleep hotkey function?
As far as I know, no, it just disables the link in the menu, rather than disabling the feature itself.
Great! This works fine! If you still want can add these lines using a terminal –>
gconftool -s /apps/gnome-power-manager/buttons/hibernate -t string interactive
gconftool -s /apps/gnome-power-manager/buttons/suspend -t string interactive
this will disable the functions keys 😉
I’ll have to look into that and add it to the blog post 🙂 Thanks mate 🙂
Thanks a lot Maurício! I wanted to set the XF86Sleep key to “Lock Screen” and defined it as such in System>Preferences>Keyboard Shortcuts. However, pressing the key always invoked suspend. Obviously, the setting in /apps/gnome-power-manager/buttons/suspend dominated “Lock Screen”. Thus, changing the value of /apps/gnome-power-manager/buttons/suspend from “suspend” to “nothing” in the gconf-editor resolves the problem.
Thx for this tips !
Here is the full command to disable the suspend to happens while XF86Sleep is pressed :
gconftool -s /apps/gnome-power-manager/buttons/suspend -t string nothing
thanks so much worked great, no one else has the ability to make things like this so easy, ur the best dude
Glad to hear it mate 🙂 Cheers
More “kudos”. This made my wife/kids PC a lots simpler.
THANK YOU…. I have been searching on the internet for a long time trying to resolve this problem. You fixed it in a matter of minutes. Thanks for your advice! No more accidental hibernations 🙂
thanx mate!real useful!lubuntu user here 🙂
One problem with this approach is that the settings can be overwritten with a package upgrade. The preferred way to do it is documented in the pklocalauthority man page. In short, create a file in /etc/polkit-1/localauthority/50-local.d with a .pkla extension with the following contents:
[Disable suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultAny=no
ResultActive=no
ResultInctive=no
[Disable hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultAny=no
ResultActive=no
ResultInctive=no
This works at least on Ubuntu 10.04.
Nice one, thanks for the update!
fully recommend this
http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug
it worked for me on an asus g73jw with the latest ubuntu natty
gksudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy….here hibernate is already activated but still i am unable to hibernate my machine. it does not appear in the menubar too.
How much RAM and swap does your machine have? You need to have at least as much swap as you do RAM to hibernate correctly.
gconftool -s /apps/gnome-power-manager/buttons/hibernate -t string interactive…..how to change dis comment to enabler hibernate…pls help
Thank you 🙂
Your Welcome 🙂