How to disable Suspend and Hibernate for all users in Ubuntu

8 February 2007

I’ve known about this trick for a while now; just forgotten to blog about it.

Do you have a computer on which Suspend or Hibernate crashes, or is unstable? Is your computer shared? Do they tend to just click on everything they possibly can, then click Suspend, then OOPS! Look forward to a 5-minute fsck on next bootup! ;)

Well, here, I’m going to tell you how to remove the Suspend and/or Hibernate buttons in the Quit dialog in Ubuntu versions 6.06 and 6.10.

Step One

Press Alt+F2. A dialog box will come up entitled ‘Run Application’. In the text entry field, type:

gksu gconf-editor

…and click ‘Run’. You may be prompted with your password, in which case, enter your password.

Step Two

An application named ‘Configuration Editor’ will come up. This program is for editing fine-grained details about your desktop. GNOME contains a database for storing your preferences called ‘gconf’. Configuration Editor is an application which edits the gconf database. Windows users may be familiar with the registry, which is a similar database.

In the Configuration Editor, navigate through the tree (located on the left-hand pane in the window) to:

/ → apps → gnome-power-manager

Step Three

In the right-hand pane, a new set of ‘keys’ have appeared. These keys are specific to the gnome-power-manager, which you selected in the previous step. Find the keys named ‘can_hibernate’ and ‘can_suspend’. Uncheck them both.

In Ubuntu version 6.06, the ‘can_suspend’ key is already unchecked. This is normal.

Step Four

Now, right-click on ‘can_hibernate’. From the context menu, choose Set as Mandatory. No dialog box will come up confirming that it worked, but I promise, it worked!

Do the same for ‘can_suspend’. Now, close the Configuration Editor.

Step Five

Log out of your system (From the System menu, choose Quit, then choose Log Out). Now log back in. You should now see that when you go to the Quit menu, the Suspend and Hibernate buttons are gone.

I accept credit card or cheque. Or both. ;)

18 replies

  • Scott says:

    Only works for me if I don’t use gksu

  • Jeremy says:

    Are you sure you logged out and back in again?

    Of course, it’s fine not to use gksu. It’s just that you’ll have to repeat the steps for all the users in your system.

  • Logan says:

    A slight variation on Gutsy – I had to look under / → apps → gnome-power-manager → general to find the keys. Great work!

  • Jeremy says:

    Ah, so it has changed.

    I didn’t notice, because I got a new motherboard with an NVIDIA nForce chipset that supports suspend out of the box, so I have no need to disable suspend/hibernate now. :)

  • Briareos says:

    Thanks that saved my Linux Terminal Server Project Installation with 20 Users :)

  • ElPraga says:

    Thanks a lot man! I am really surprised that something (in my opinion) quite important does not appear under official documentation of the applet… People can easily by accident get the computer into a difficult stage if suspend is not working. Then they will just say, that ¨the linux is not working” :-)

    Thaks a lot again.

    Tomas

  • selfservix says:

    All right. I followed the procedure and effectively got rid of the hibernate option. Now the problem is that there is no way back. After the next login, the keys are marked as not writable and I cannot re-activate them ???

  • Jeremy says:

    I’ve had a poke around my system, and it’s been so long since I’ve done this that I honestly don’t remember how to diagnose it. Sorry. :(

  • Justin Rennell says:

    Thanks, this is exactly what I was looking for. I couldn’t override the settings with the acpi settings file, and I could only prevent sleeping on lid close for a logged-in user. The laptop no long can sleep at all when gnome is running! :)

  • Codrin says:

    U R da MAN ! From some obscure reason, sleep hibernate and the rest never worked for me on more than 10 different types of desktops and at least 3 laptops that I have. I use Centos btw. I was looking for a way to disable the sleep and the rest all together.
    PS: from another obscure reason, in the standard instalation of centos, redhat or fedora, utilities like mc, iptraf, gconf-editor and many others are not present. I’m dying to know what was in the head of the guy that decided that they are not useful immediately after install….

  • Leo says:

    As for Ubuntu 10.04 there are no such options in the menu.

    In → apps → gnome-power-manager there is nothing.
    In → apps → gnome-power-manager → general there are other options but not these.

  • Maurício Luciano says:

    This solved for me on my Ubuntu 10.04.

    In a Terminal → 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. In section will be a line with:

    <action id="org.freedesktop.upower.suspend">
    ...
    <allow_active>yes</allow_active>

    Change this entry from “yes” to “no” to disable suspend.

    <action id="org.freedesktop.upower.hibernate">
    ...
    <allow_active>yes</allow_active>

    Change this entry from “yes” to “no” to disable hibernate.

    For disable the functions keys:

    gconftool -s /apps/gnome-power-manager/buttons/hibernate -t string interactive
    gconftool -s /apps/gnome-power-manager/buttons/suspend -t string interactive

    Cheers.

  • Will says:

    Thank you Maurício! That worked a treat for me. :)

  • yss says:

    Thanks a lot Mauricio!!!!!!!!!

    I really need the information !!

  • BrotherE says:

    Mauricio’s information works for 10.10 also. I just set up a Linux notebook for my non-computer relative who lives on the other hemisphere. Disabling suspend etc. was key.

    Thank you.

  • another way to do it on 10.04 LTS Ubuntu without worrying about your PolicyKit-1 config being overwritten by an update or an upgrade would be to add the following file to /etc/polkit-1/localauthority/50-local.d/50-admin.pkla

    You will need to do another bracket section for the hibernate action if you want to disable that as well. you can also set no to auth_admin to force an admin password dialog instead.

    Editing the files in /usr/share/polkit-1/actions is not a good idea because they define default actions and will be over-written in an upgrade (or worse will stick around after an update that may need to define extra stuff in the action file and you will have things subtly break on you)

    here’s the file contents:

    [disable suspend]
    Identity=unix-user:*
    Action=org.freedesktop.upower.suspend
    ResultAny=no
    ResultInactive=no
    ResultActive=no

  • Eike Baran says:

    Thanks Maurício Luciano for you great solution! seems to work on ubuntu 12.04 as well!

    greetings!

Leave a reply

Change your avatar.