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.
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 saw here, bugs.archlinux.org/task/16970, that the files used to be stored as .cvs files in ~/.gnome2/gnome-power-manager/, obviously they aren't there anymore but at least it hints that they might still be .cvs files. Also, the poster there found out that information by asking at #gnome on irc.gnome.org, so you could try that to find out where the files are now. May 21, 2012 at 5:54
This is quite interesting that the battery information on gnome-power manager is now stored in a persistent database. I wonder how the graphs for accuracy of battery life prediction are produced.– viyyerMay 21, 2012 at 13:22
My mistake, Ubuntu actually uses freedesktop's UPower power manager now rather than gnome-power manager, after looking through the source of UPower I think I've found the persistent history database. I will update my answer with the results. May 21, 2012 at 17:30
1also, not particularly relevant now that we've found the history databases, but I was wrong about power-manager getting the information from /proc/acpi/battery/BAT0/info, it actually seems to get it from /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0 May 21, 2012 at 18:01
After deleting the files, my history is still skewed. My laptop dies around 73%. I know that my battery is faulty but for now I really just need a heads up before it's empty (around 30 min). Any other ideas on how to reset UPower (MATE Power Manager)? May 3, 2017 at 1:44
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.
1Just an addendum: /sys/class/power_supply is a useful symlink for /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply (as in adempewolff's comment above) May 21, 2012 at 21:30
It might just hold the data points in memory, or write them to swap space before writing them to disk every 10 minutes. I don't really see why, but I can't find any other files in UPower's directories resembling a log... May 22, 2012 at 3:03
1also, given the results of your testing, I think deleting the files should meet @viyyer's needs--it will delete all history of the old battery that it messing his statistics up. Alternately, he could go into the files and only delete the data points from prior to the new battery. May 22, 2012 at 3:13
I just deleted the
.datfiles and they where re-generated (not sure if it happen immediately, but they are there). On Ubuntu Mint 16.04 May 3, 2017 at 1:09
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%.
8I don't know if I believe this. I believe it asks you to plug in the charger before installing because running out of battery in the middle of installation, or god forbid in the middle of partitioning, would at best leave you with an unusable Ubuntu and at worst fry the other OSes partition tables. May 27, 2012 at 8:07