Is there a way to suspend when Ubuntu is at critically low power. The only option in Ubuntu 11.10 power setting is to shutdown or hibernate. I run my battery all the way down till it suspends then i plug it in. It gets annoying when my computer hibernates at critically low power.

Thanks in advance for the help

  • 1
    have you checked the power management??? I'm pretty sure there is an option for that! – Vineet Menon Nov 3 '11 at 6:28
  • Yes I did unless Ubuntu power setting isn't the power manager. – Ryan Nov 3 '11 at 13:47
  • 1
    Is it just me or does everyone see images of food stuff in that link? ^ – Mahesh Dec 2 '12 at 9:39
  • Nope that screen shot appears to be food stuffs. – coteyr Dec 3 '12 at 17:12
  • I really hope this gets answered. Find this to be most annoying. – coteyr Dec 4 '12 at 19:58

Not sure why power settings only offers hibernate or shutdown.
You can change the option to suspend using dconf-editor:
Browse to org->gnome->settings-daemon->plugins->power, and change the value of critical-battery-action to "suspend".

  • Doesn't seem to have any effect on my machine. :\ – Tomislav Nakic-Alfirevic Jun 20 '12 at 21:11
  • This doesn't seem to do a thing on my machine. – coteyr Nov 29 '12 at 2:38
  • I have confirmed that this DOES NOT WORK. It shows a message about suspending, then powers off the computer via shutdown. – coteyr Nov 30 '12 at 20:40

Just a hunch, but I believe that at critically low power, the system doesn't have enough power to even sustain suspend mode - yes, the suspend mode, though is low on power consumption, draws power to keep data on the RAM. So, even if the system suspends, it will immediately power off. This is probably why jpd's solution didn't work.

Why I believe so? I've noticed that after the system powers off due to critically low power it is impossible (at least on my laptop) to turn it on without plugging it in. So critically low power must mean 'cannot carry on' and not 'just 5 minutes left' or something like that.

I think what you want is for the system to suspend when about 10 minutes of battery is left. I don't know how to attack that problem, but I believe Unity notifies you about this. In my case this notification is sufficient.

  • I checked this, and it doesn't seem right. The command executed is to shutdown not suspend. A suspend is not even attempted. – coteyr Dec 2 '12 at 17:44

On my machine the current state of the battery can be read-off from /proc/acpi/battery/BAT1/state

Sample content of this file:

present:                 yes
capacity state:          ok
charging state:          charging
present rate:            749 mA
remaining capacity:      530 mAh
present voltage:         11200 mV

You can locate the appropriate file on your machine and use this to suspend when battery is in critically low power. The following python script will do it for you:

import os
import time

battery_state_file = "/proc/acpi/battery/BAT1/state"
critically_low_power = 500
suspend_command = "sudo pm-suspend"

while True:
    f = open(battery_state_file)
    content = f.read().split('\n')
    if content[2].split()[2] == "discharging":
        if int(content[4].split()[2]) < 500:

Save this to a file (say) suspendscript, make it executable, add suspendscript & to .xsessionrc in your home folder, logout and log back in.

You have to set battery_state_file and critically_low_power appropriately. If remaining capacity drops below 'critically_low_power' mAh, the system will suspend. Optional: You can, if you want, use "present rate" and "remaining capacity" to find "expected time left" (= "remaining cap."/"present rate" hours) and suspend if time left drops below a certain threshold.


  1. This code will have to be modified if the content of the statefile is not in the same format as the sample content given above.
  2. sudo pm-suspend requires the sudoer to give his password. You have to make pm-suspend sudoable without password. See how: How do I run specific sudo commands without a password? . Alternatively, you can change suspend_command to simply pm-suspend and add sudo suspendscript & to .xsessionrc and make suspendscript sudoable without password.
  3. If you use this script, you have to set 'critically low power action' to 'do nothing' in gnome-power-manager settings.
  • @coteyr Did this work for you? – S Prasanth Dec 13 '12 at 14:20

See my comment on Touchpad stopped working on an Acer AspireOne D255E - I think your problem is with the pm-utils package, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.