Ubuntu – Netbook performs hard shutdown without warning on low battery power

power-managementshutdown

My Asus EEE netbook performs a hard shutdown when it reaches low battery power, without giving any warning – i.e. the power just goes off, without any shutdown process. I can't find anything in the syslog, and no error messages are printed before it happens. I've had this problem on previous (K)Ubuntu versions, and hoped updating to Ubuntu Precise would help resolve the issue, but it hasn't.

The option in the Power application for "when power is critically low" is currently blank – the only options are a (grayed-out) hibernate and "Power off".

I have re-installed indicator-power to no effect. The time remaining reported by acpi is unstable, as is the time remaining reported by gnome-power-statistics. (For example, running acpi twice in succession, I got 2h16min, and then 3h21min remaining. These sorts of jumps in the remaining time are also in the gnome-power-statistics graphs.)

It might be possible to write a script to give me advance warning (as per @RanRag's comment below), but I would prefer to isolate why I don't get a critical battery notification from the system before this happens, so that I can take action as appropriate (suspend/shutdown/plug in power) when I get a notification.

Some additional information on the battery:

kroon@minia:~$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/PNP0C0A:00/power_supply/BAT0
  vendor:               ASUS
  model:                1005P
  power supply:         yes
  updated:              Fri Aug 17 07:31:23 2012 (9 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    energy:              33.966 Wh
    energy-empty:        0 Wh
    energy-full:         34.9272 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         3.7692 W
    voltage:             12.61 V
    time to full:        15.3 minutes
    percentage:          97.248%
    capacity:            73.5%
    technology:          lithium-ion
  History (charge):
    1345181483  97.248  charging
    1345181453  97.155  charging
    1345181423  97.062  charging
    1345181393  96.970  charging
  History (rate):
    1345181483  3.769   charging
    1345181453  3.899   charging
    1345181423  4.061   charging
    1345181393  4.201   charging

kroon@minia:~$ cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            332 mA
remaining capacity:      3149 mAh
present voltage:         12612 mV
kroon@minia:~$ cat /proc/acpi/battery/BAT0/info
present:                 yes
design capacity:         4400 mAh
last full capacity:      3209 mAh
battery technology:      rechargeable
design voltage:          10800 mV
design capacity warning: 10 mAh
design capacity low:     5 mAh
cycle count:              0
capacity granularity 1:  44 mAh
capacity granularity 2:  44 mAh
model number:            1005P
serial number:            
battery type:            LION
OEM info:                ASUS

Best Answer

When a battery reaches to the point of time to take critical action taking level , Ubuntu won't warn you about this, instead it just perform the action required (such as suspend, hibernate, shutdown etc, based on your choice). This is the setting and it can't be changed. But Ubuntu should give you a warning, when battery reach low level and critical level.

By default, Ubuntu uses time remaining as a trigger of it's pre-defined action.

  • You will be given a low battery warning, before 1200 seconds (20 minutes) to be empty.
  • You will be given a critical battery warning, when it reaches 300 seconds (5 minutes) remaining
  • Battery critical action is performed when only 120 seconds (2 minutes) remaining.

The power statistics from your output suggests a bad/damaged battery. In these cases, it is hard for Ubuntu to measure actual time remaining data. Also the battery drains quickly between from 300 seconds to 120 seconds, so just try to shut down the PC which is configured in the settings.

I suggest you to do this,

  • First change the policy of trigger from time to percentage.

    gsettings set org.gnome.settings-daemon.plugins.power use-time-for-policy false
    
  • Then raise the percentage required to give you a warning, the default is 10%. Change it to 30%.

    gsettings set org.gnome.settings-daemon.plugins.power percentage-low 30
    
  • Then raise the percentage required to be considered as critical to 20%, default is 3%.

    gsettings set org.gnome.settings-daemon.plugins.power percentage-critical 20
    
  • Then raise the percentage required to take the critical action, it is now 2%. change it to 15%

    gsettings set org.gnome.settings-daemon.plugins.power percentage-action 15
    
  • Then change the critical action to be taken to hibernate, instead of shutdown. You need to first enable the hibernate option.

    Then use this command to change it to hibernate.

    gsettings set org.gnome.settings-daemon.plugins.power critical-battery-action hibernate
    

I think, this should solve your problem. If you still have problems with level, raise the levels even higher.

Related Question