Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ubuntu 12.04 64bit refuses to hibernate when battery is critically low. Instead it does a complete shutdown which is unnecessary and can cause loss of data.

I have enabled Hibernate (pm-hibernate) on following the common instructions I tested pm-hibernate it is works fine when run manually.

I have set my power options to hibernate "When Power is Critically Low". This has also been verified by using dconf Editor. Under org > gnome > settings-daemon > plugins > power > critical-battery-action it is set to "hibernate". Under the same schema, time-action is set to "120".

I would like to see what is happening just prior to this shutdown. I would like to know what logs to search to see if pm-hibernate is actually failing, or if it is being ignored entirely.

Barring figuring this out on my own, is there a suggested work around?

share|improve this question
add comment

1 Answer

I have/had the same problem with 12.04 non-precise power monitoring, some possibilities:
(to cut to the chase and avoid the rhetoric read the final point - it is irritating that a "fix" is needed to restore such mundane and ordinary functionality)

  1. Unity and 12.04 do not provide the functionality of 10.04 that has more robust reliability, especially power management, so regression is the option I use. The sophisticated maturation of a computing system environment (Debian, GNU, Linux, ...) requires a high degree of comparable rigorous discipline to retain and modify functionality consistently. Consequently, several well established software paradigms have degraded and been compromised including power management.

  2. reference:
    Bug #993440 “No suspend option for critical battery state in pow...” : Bugs : “gnome-control-center” package : Ubuntu:
    solution: (manually labour intensive)
    lp:~jlangvand/ubuntu/quantal/gnome-control-center/fix-for-993440

  3. Write a script (more manually labour intensive) using pm-hibernate (pm-suspend), watch, upower, grep etc. to monitor the battery state and take action when required.

    pseudo code outline:
    Use watch, every few minutes, to periodically compare grep upower -d battery stats to gsettings get org.gnome.settings-daemon.plugins.power percentage-critical, and when threshold is exceeded sudo pm-hibernate

    crude (as in prototyping only, non-executable) draft: (suspend for any battery % < 10%)
    upower --monitor-detail | grep "percentage[^\d]+\d\.\d*\%" | bash pm-suspend

    an elegant solution

    • aborts further watching on suspend
    • checks all transient power supplies: UPS's, tertiary batteries, solar panels (power diminishes at dusk and by clouds), etc.
    • allows for non-privileged suspension (/ hibernation) for restricted users

refs:

Battery performance can be examined with:

  • upower
    • watch -d upower -i /org/freedesktop/UPower/devices/battery_BAT0
    • upower --monitor-detail | grep percentage
  • gnome-power-statistics

How to check battery status using terminal?
How to see the discharge rate of the battery

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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