Ubuntu: how can I reset the battery statistics for the powermanager?


I changed my batteries and the battery statistics of the GNOME manager got skewed. Where would the files having the battery statistics be?


Edit: Ubuntu now uses freedesktop's UPower power-manager. After looking through the source for UPower it looks like the persistent database where the history is stored is defined as history-%s-%s.dat. I searched through my filesystem and my database names are:

./var/lib/upower/history-time-empty-DELL_KP4377-57-22096.dat  ./var/lib/upower/history-time-full-DELL_KP4377-57-22096.dat  ./var/lib/upower/history-charge-DELL_KP4377-57-22096.dat  ./var/lib/upower/history-rate-DELL_KP4377-57-22096.dat  

Your file names will obviously be different but they should be in the same directory (/var/lib/upower/)regardless. These four files, despite being ".dat" files are really just human readable text documents with the history. I'd say back up these files, then either delete them or delete their contents and you should be good to go! Let me know how it works.

Original answer:

Good question. One would think that gnome-power-manager would have it's own log file somewhere for storing it--I can't find anything of the sort however.

It looks like most of the information it reads about the battery comes from acpi via /proc/acpi/battery/BAT0/info (my path is "BAT0" yours might be different from yours) For example, here's mine:

present:                 yes  design capacity:         5200 mAh  last full capacity:      3665 mAh  battery technology:      rechargeable  design voltage:          11100 mV  design capacity warning: 520 mAh  design capacity low:     157 mAh  cycle count:          0  capacity granularity 1:  52 mAh  capacity granularity 2:  52 mAh  model number:            DELL KP4377  serial number:           22096  battery type:            LION  OEM info:                DP-SDI52  

But other than cycle count and last full capacity there isn't a lot of history information here, so there must be another file somewhere that gnome-power-manager is using for the history information. It's possible that rather than storing it in it's own file it is using some larger database that gnome uses for a variety of settings... I suppose it's also possible that ACPI might store the history information somewhere as well, although once again there doesn't seem to be any documentation for this.

If they exist, you might get some more attention for your question by people who know gnome-power-manager better if you add some more specific tags, ie. "gnome-power-manager", "acpi", etc. Sorry I can't help you much, good luck!


Just tried the delete-files approach. I assumed that since upowerd was still running, these files would be automatically regenerated, but they weren't â€" nor were they there immediately after rebooting.

Initially, after deleting /var/lib/upower/*.dat, gnome-power-statistics just ran as a blank GUI window with no content, but returned to its usual self after the reboot. Strangely enough, it was showing a couple of minutes of battery history from since the reboot without anything having recreated the /var/lib/upower data files, and I couldn't find anywhere else in the filesystem where it could have been storing the data (there were no file descriptors for upowerd or gnome-power-statistics pointing to anywhere on the filesystem, just kernel sockets).

I assume that something other than upower must have a short-term log of this data, which is what was being displayed in gnome-power-statistics. Running "upower -d" also outputs history points for charge and discharge rate when the data files don't exist, so presumably it can also access the same data source that is independent of the /var/lib/upower history files. upowerd appears to recreate the data files after about ten minutes post-deletion, so perhaps these are required to store data points over a longer period of time.


Harry, your right. Don't you remember Ubuntu asking you to plug in the charger before installing? That's because it's taking a snapshot at how much the battery can hold. If you want to reset the power-manager, I presume you're going to need to re-install Ubuntu or try a power-cycle. In other words, let your battery die out and then turn it on at the same moment you plug in the charger, and keep it on until it hits the 100%.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »