Bug 55278 - upower is very confused by two batteries
Summary: upower is very confused by two batteries
Status: RESOLVED MOVED
Alias: None
Product: upower
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-24 09:11 UTC by Lennart Poettering
Modified: 2018-06-04 13:31 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Lennart Poettering 2012-09-24 09:11:44 UTC
Since about always udisks has been very confused by two batteries (like I have them i my Thinkpad T410s). When the first battery is empty upower/gnome-shell will warn me very very loudly that power runs out, even though I still have the second fully charged one in the laptop too. It warns that it would go into hibernation mode soon, but until now it never actually did that. After a while it did notice again that the second battery is there and fully charged and would then stop showing its warnings, which allowed me to just ignore this weirdness. But it got worse now. With upower in F18 it actually does go to hibernation when the first battery is empty. And since my laptop seldom awakes properly from hibernation my work is all lost as soon as the first battery is empty. Having that second battery hence brings me no benefit at all... :-(

$ rpm -qa upower
upower-0.9.17-2.fc18.x86_64

$ grep . /sys/class/power_supply/*/*
/sys/class/power_supply/AC/online:1
/sys/class/power_supply/AC/type:Mains
/sys/class/power_supply/AC/uevent:POWER_SUPPLY_NAME=AC
/sys/class/power_supply/AC/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/BAT0/alarm:199000
/sys/class/power_supply/BAT0/charge_full:3997000
/sys/class/power_supply/BAT0/charge_full_design:4329000
/sys/class/power_supply/BAT0/charge_now:3178000
/sys/class/power_supply/BAT0/current_now:0
/sys/class/power_supply/BAT0/cycle_count:0
/sys/class/power_supply/BAT0/manufacturer:SANYO
/sys/class/power_supply/BAT0/model_name:42T4832
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:30770
/sys/class/power_supply/BAT0/status:Unknown
/sys/class/power_supply/BAT0/technology:Li-ion
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=12172000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CURRENT_NOW=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=4329000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=3997000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=3178000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=42T4832
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=SANYO
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=30770
/sys/class/power_supply/BAT0/voltage_min_design:11100000
/sys/class/power_supply/BAT0/voltage_now:12172000
/sys/class/power_supply/BAT1/alarm:96000
/sys/class/power_supply/BAT1/cycle_count:0
/sys/class/power_supply/BAT1/energy_full:19230000
/sys/class/power_supply/BAT1/energy_full_design:31320000
/sys/class/power_supply/BAT1/energy_now:2110000
/sys/class/power_supply/BAT1/manufacturer:SONY
/sys/class/power_supply/BAT1/model_name:51J0508
/sys/class/power_supply/BAT1/power_now:22511000
/sys/class/power_supply/BAT1/present:1
/sys/class/power_supply/BAT1/serial_number: 2132
/sys/class/power_supply/BAT1/status:Charging
/sys/class/power_supply/BAT1/technology:Li-poly
/sys/class/power_supply/BAT1/type:Battery
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_NAME=BAT1
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_STATUS=Charging
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_TECHNOLOGY=Li-poly
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_VOLTAGE_NOW=12038000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_POWER_NOW=22511000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_ENERGY_FULL_DESIGN=31320000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_ENERGY_FULL=19230000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_ENERGY_NOW=2110000
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_MODEL_NAME=51J0508
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_MANUFACTURER=SONY
/sys/class/power_supply/BAT1/uevent:POWER_SUPPLY_SERIAL_NUMBER= 2132
/sys/class/power_supply/BAT1/voltage_min_design:10800000
/sys/class/power_supply/BAT1/voltage_now:12038000
Comment 1 Onuralp SEZER 2012-11-06 21:33:01 UTC
I connect my Keyboard&Touchpad Mini Keyboard via bluetooth and Gnome indicator and upower try get Keyboard battery information and yes good things I can see my keyboard batter info but labe as "Laptop Battery" which It must be fix first then when I try to disconneted. Upower also try re-calculate my battries and then It will be crash 2 times. 

backtrace_rating: 4
Package: upower-0.9.18-2.fc18
OS Release: Fedora release 18 (Spherical Cow)

I found another problem about for upower when I try get power info always show and terminal results 

[23:17:24.106]	device changed:     /org/freedesktop/UPower/devices/battery_hid_XXXXXXXXXXXXXXXXX_battery
  native-path:          /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.0/bluetooth/hci0/hci0:4/0005:0A5C:8502.0009/power_supply/hid-XX:XX:XX:XX:XX:XX-battery
  model:                Macro Keyboard
  power supply:         no
  updated:              Tue Nov  6 23:17:24 2012 (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    energy:              0 Wh
    energy-empty:        0 Wh
    energy-full:         0 Wh
    energy-full-design:  0 Wh
    energy-rate:         0 W
    percentage:          100%
    capacity:            100%

grep . /sys/class/power_supply/*/*

/sys/class/power_supply/ADP0/type:Mains
/sys/class/power_supply/ADP0/uevent:POWER_SUPPLY_NAME=ADP0
/sys/class/power_supply/ADP0/uevent:POWER_SUPPLY_ONLINE=0
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:54
/sys/class/power_supply/BAT0/charge_full:4860000
/sys/class/power_supply/BAT0/charge_full_design:5200000
/sys/class/power_supply/BAT0/charge_now:2672000
/sys/class/power_supply/BAT0/cycle_count:0
/sys/class/power_supply/BAT0/manufacturer:Clevo CO.
/sys/class/power_supply/BAT0/model_name:X51
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number: 
/sys/class/power_supply/BAT0/status:Discharging
/sys/class/power_supply/BAT0/technology:Li-ion
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=14800000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=5200000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=4860000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=2672000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=54
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=X51
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Clevo CO.
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER= 
/sys/class/power_supply/BAT0/voltage_min_design:14800000
/sys/class/power_supply/BAT0/voltage_now:14800000
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/capacity:100
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/model_name:Macro Keyboard
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/online:1
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/present:1
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/scope:Device
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/status:Discharging
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/type:Battery
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_NAME=hid-DC:2C:26:A9:57:61-battery
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_CAPACITY=100
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_MODEL_NAME=Macro Keyboard
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/hid-DC:2C:26:A9:57:61-battery/uevent:POWER_SUPPLY_SCOPE=Device
Comment 2 Domen Kožar 2013-09-23 22:30:58 UTC
Same here with Lenovo Helix. When first battery is empty, upower suspends the machine. Quite annoying, what extra logs would you need?
Comment 3 Bastien Nocera 2013-10-12 13:57:32 UTC
It's not UPower suspending the machine, but whatever runs in your session, handling power events. For GNOME, that's gnome-settings-daemon.

Please file a bug against your desktop environment with information such as version of the component, and the output of "upower -d" when (or rather, just before) the problem happens. There should be a "battery low" warning before the battery critical warning and the suspend/switch off.
Comment 4 Domen Kožar 2014-01-21 16:34:06 UTC
What desktop environments are others using? I'm experiencing this at XFCE 4.10.
Comment 5 Domen Kožar 2014-01-21 16:41:59 UTC
Reported upsteam to XFCE: https://bugzilla.xfce.org/show_bug.cgi?id=10641
Comment 6 Domen Kožar 2014-12-16 19:03:07 UTC
I'd like to reopen this. It's annoying and I believe an upstream bug.

Output of upower -d: http://paste.ofcode.org/ZcEyNLTWRRMC33z2DfQUSq

In BAT0 history you can clearly see how it's changing state from charging to discharing although the power cable has been disconnected for nearly half an hour.

All notifications and actions are based on upower api, including suspend action.

Let me know if you want more information, I'm using Lenovo Helix model (first edition).
Comment 7 Bastien Nocera 2015-04-02 14:17:59 UTC
Please test this with newer versions of UPower, at least version 0.99.2.
Comment 8 Christoph 2018-03-18 08:53:59 UTC
I'm running Ubuntu 17.10 on a Lenovo T460s. UPower is at version 0.99.6 and the problem is still there. Whenever one of the two batteries is empty my laptop simply powers off.

I am shocked to see that this is a 6 year old bug. The main recommendation seems to simply uninstall upower (see https://forums.lenovo.com/t5/Linux-Discussion/How-to-get-dual-battery-to-switch-without-powering-off-in-Linux/td-p/3890605).

I don't know enough about what upower exactly does so I am very reluctant to simply kick it to the curb.
Comment 9 Bastien Nocera 2018-03-18 13:26:53 UTC
(In reply to Christoph from comment #8)
> I'm running Ubuntu 17.10 on a Lenovo T460s. UPower is at version 0.99.6 and
> the problem is still there. Whenever one of the two batteries is empty my
> laptop simply powers off.
> 
> I am shocked to see that this is a 6 year old bug. The main recommendation
> seems to simply uninstall upower (see
> https://forums.lenovo.com/t5/Linux-Discussion/How-to-get-dual-battery-to-
> switch-without-powering-off-in-Linux/td-p/3890605).
> 
> I don't know enough about what upower exactly does so I am very reluctant to
> simply kick it to the curb.

Seeing as it took 3 years for somebody to test with a newer version as requested, and that we don't have access to any hardware to test this, it's not really surprising.

Edit /lib/systemd/system/upower.service to "--verbose" to the upowerd command-line, and reboot your system. Send us the output of "journalctl" after the problem happens (use "journalctl -b" to get just the current boot's journal).
Comment 10 Bastien Nocera 2018-03-18 13:28:50 UTC
We also have a test for multi-battery setups which doesn't show the problem:
https://cgit.freedesktop.org/upower/tree/src/linux/integration-test#n410
Comment 11 GitLab Migration User 2018-06-04 13:31:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/upower/upower/issues/62.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.