[RESPONDED] Battery percentage gets misreported as 0% occasionally

This would be my assumption, however, if the adapter is working with one laptop and not another (FW), it gives us a place to start from.

Provide the output requested. That is what I can help with. Again, we don’t actually know what the issue is.

I’ve disabled and masked upower.service, which apparently is incapable of not shutting down the system when the battery reports 0%. Hopefully this will at least let me read the journal for anything suspicious and also run the commands you posted if this happens again.

+1 for me too! I also see the popup occasionally on my 12th gen i5-1240P. I am running kubuntu, and it would occasionally pop saying battery was at 5%, 9%, and so on. I never got around to finding out where it’s wrong though.

As for my device, I’ve seen it happen on different chargers in different places:

  • 100w charger
  • 65w lenovo USB C charger

I just hit this again (also while plugged in), but I think it fixed itself because the charge state in sysfs looks reasonable

~> cat /sys/class/power_supply/BAT1/status
Discharging
~> cat /sys/class/power_supply/BAT1/charge_now
3286000
~> cat /sys/class/power_supply/BAT1/charge_full
3286000
~> cat /sys/class/power_supply/ACAD/online
1

The UPower command’s output also looks fine, however I could only start UPower after the problem happened, so it probably didn’t catch it.

~> upower -i /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  vendor:               NVT
  model:                Framewo
  serial:               0251
  power supply:         yes
  updated:              Tue Oct 17 07:21:10 2023 (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              50.6044 Wh
    energy-empty:        0 Wh
    energy-full:         50.6044 Wh
    energy-full-design:  55.0088 Wh
    energy-rate:         1.2936 W
    voltage:             17.385 V
    charge-cycles:       163
    time to empty:       39.1 hours
    percentage:          100%
    capacity:            91.9933%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (charge):
    1697520070  100.000 discharging
    1697520070  0.000   unknown
  History (rate):
    1697520070  1.294   discharging
    1697520070  0.000   unknown

Here’s how KDE surfaces the issue when it happens:
screenshot-2023-10-17-07:19:03

You may want to edit your module block list and add cros_ec_lpcs or cros_ec_debugfs.

1 Like

If you feel it has been resolved, do let us know. If not, it’s worth trying DHowett’s suggestion next.

@Matt_Hartley This seems to be an issue in your firmware, so I do hope you are tracking it internally. Disabling the kernel modules can only work around the issue by reducing communication with the EC (so that the race condition is less likely to happen). I will give that a try though.

Please file a ticket, we’ll see if we can replicate. Thus far, no luck on my end.

@jschievink Regarding your inability to prevent the shutdown in an orderly fashion, read this for some background:

Be advised: it’s a depressing reading. In short: authoritarian tendencies of some free software developers at full display.

FYI, I’ve had a similar issue on a previous laptop (where the battery was at fault) and I believe I was able to prevent the shutdown by setting PercentageAction to 0 in /etc/UPower/UPower.conf.

I’ve been seeing this on a fresh Ubuntu 23.04 installation (with latest updates). (On FL13 11th gen with latest BIOS)

Usually start seeing these within 30 minutes of having executed the following, in this order, while plugged in (in my case):

  1. Ctrl-Alt F2 to get to tty
  2. Login
  3. sudo init 3 (just to minimize the number of processes)
  4. sudo ectool fanduty 100
  5. geekbench6

Then the “packet too long” will start showing up within 30 minutes of that.

If from a fresh reboot, and I only do steps 1, 2 and 3…then it would happily sit at the terminal quietly.

Additional note:
ectool was compiled from GitHub - DHowett/framework-ec: Embedded Controller firmware for the Framework Laptop with instructions from the Instructions section here.

I’m seeing this issue as well.

Framework 12th gen i5-1240P, 3.04 firmware, Ubuntu/Kubuntu 23.10 and now 24.04.

While whatever is happening in the kernel happens regardless of DE, the alerts only pops up under KDE, not Gnome. What is interesting to me is that when warning appears, KDE seems to think that the battery state of charge is less than 10% (it will report varying numbers) and then within a second it will report the correct state of charge.

I do see the cros_ec_lpcs packet too long errors from dmesg.

My laptop generally stays plugged in, so I have enabled the charge limit at 75%. I have been charging the laptop through a USB-C hub so that I can have one connection to the laptop. Based on this thread I’m trying providing power on a different port that is directly connected to the power supply and not going through the USB-C hub. I use an Anker GaN power supply. I have already tried plugging the hub into different ports on the laptop. My next experiment if the dedicated power line doesn’t resolve it will be to use the OEM Framework charger, and I will also try switching the USB-C cable (one experiment at a time).

Update 1

After a few hours I got the battery is critical warning under KDE again, so I have switched to the Framework OEM charger.

Have you ever had this problem with an OEM charger since?

I’ve had the same problem since I got my 12th gen Framework with KDE, regardless of the charger (140W PPS, 65W PPS, 60W PD, 30W PPS Phone charger) but I haven’t bought and tested an OEM charger yet.

I’m having this issue as well with KDE Neon.
11th gen intel 13" with OEM charger.
It started like a month ago, I’d say

It is pretty rare, but still occurring for me. Now on Arch 6.9.x kernel, and i5-13 Mainboard. It never says zero, but I do get random single digit numbers reported for current battery SOC, even if true SOC is 50+%.

No discernible pattern that I have found. Different chargers, different cables, etc and no change really. But it’s really rare when this occurs, maybe once a day at absolute maximum.

This may or may not be the same issue:

I get “low battery” toast warnings here on Arch/KDE with 12th-gen Intel. There are never any problems with charging, and the battery percentage in the tray icon is correct except while the warning is actually on-screen. These warnings appear randomly about once every half hour, with alleged battery values from 0% to 8%. Yes, it does say 0% sometimes.

I remember having this issue in the past, and it resolved itself in a few weeks. We’ll see if that happens again.

Just adding my personal experiences with this issue to the thread…

I have a 2023 Framework 13 (12th Gen Intel) that I initially installed Ubuntu 22.04 on, and later upgraded to Ubuntu 24.04.
I’ve been having a similar issue with the battery charge sporadically reporting a value below 10% for a second or two before going back to 90+%. The graph of the charge (according to the “Power Statistics” application) looks like this.

I see this behavior whether I’m discharging the battery or have my power adapter connected. I have set my battery charge limit in the BIOS to 96%, which is why the graphs never get to 100%.

I changed my battery from the 55Wh unit to the 61Wh unit about 2 months ago, and have continued to see this issue.
I saw the issue when I was running Ubuntu 22, and have continued to see the issue after upgrading to Ubuntu 24.

I’ll have to check and see if I see the cros_ec_lpcs cros_ec_lpcs.0: packet too long error that others have reported seeing in dmesg.

Just want to report I’ve also been seeing this regularly on an 11th gen i5. I very rarely use my laptop without the charger plugged in. Max battery percentage is set to 85% and I use either the Framework charger or a Steam Deck charger which both keep the laptop at 84 or 85%.

Every 20 mins to half an hour I get a random single-digit battery percentage reported, asking me to shut down or hibernate, and the following messages:

[97327.451094] cros_ec_lpcs cros_ec_lpcs.0: bad packet checksum f7
[98371.937386] cros_ec_lpcs cros_ec_lpcs.0: bad packet checksum f7

I’ve had these or the “bad packet length” messages for the memorable past (at least a year, maybe 2) and I’m somewhat surprised it hasn’t been fixed yet.

It has, by @jubnut, for kernel 6.11+

2 Likes

@Nine_Mile Kernel 6.11 will be released this month, but in the meantime you can use the prototype version of my kernel patches: