6

I have a 2008 MacBook Air (model A1237) with Ubuntu 16.04 LTS installed on it.

I managed to solve some other problems, but I can't figure out how to find a solution to this one...

Basically the battery status does not update very quickly... This leads to shut downs of the computer when the shown battery percentage is still 50%...

Another thing that happens is that, when plugging in the power cord, it takes about 2 minutes to update, even though the laptop is charging. This means that when I'm working on stuff and the computer is running out of battery I can't tell that it's happening and the computer shuts down or goes to stand-by without warning.

Any solutions? Thanks a lot :)

Zanna
  • 69,223
  • 56
  • 216
  • 327
Brodino Caldo
  • 61
  • 1
  • 3
  • 1
    How old is that battery? If as old as the MacBook then the time to replace it was some 4 years ago... –  Nov 19 '16 at 20:26
  • I bought it last year, so it's pretty new... The point is that it works flawlessly while on OSX – Brodino Caldo Nov 19 '16 at 21:42
  • I have a MacBook 6.1 of almost the same age (late 2009) - and battery meter at 16.04 also behaves weird here: it never shows anything between 70% and 100%. It first started with original battery (at the same time MacOS started reporting it as dying), so I've replaced it with a new one, but from AliExpress. But nothing changed. So it might be some problem with old MacBooks vs Ubuntu battery metering. Or ot might be just dead batteries :) – FlasH from Ru Dec 01 '16 at 22:17
  • Possible thread necromancy here, but I've got the same issue on a laptop that shipped with Windows. One such example had shown the percentage as still sitting at 15%, but the battery was really at 5% and the laptop's hardware-based low-power mode had already activated. I believe this is due to some sort of change (or possible bug?) related to Ubuntu, as when the laptop still ran Windows the battery meter was always accurate. – Drew Stewart Jan 09 '17 at 01:41

1 Answers1

3

I have this problem as well. This is not a solution but workarounds that work for me I have found:

acpi shows the correct battery state and charging status.

sudo service upower restart forces the battery status of upower to update. I would like this to happen every time I resume my computer from hibernation so after I charge my laptop I can actually see the progress. I've come up with the following script that runs on wake:

# Restart upower on wake (put in /lib/systemd/system-sleep/)
#!/bin/sh
case $1
  post)
    service upower restart ;;
esac

I would love a real solution to this problem. I'll update my answer if I can find one.

qwr
  • 2,692
  • 23
  • 39
  • I would avoid using sleep hooks for executing scripts as the hooks causes the remaining systemd services that _properly_ execute on wakeup to hang until the sleep script executes. It's preferred to use a new systemd service with `Before=sleep.target` or `After=sleep.target` in your `Unit`. – blockloop Apr 13 '18 at 13:33
  • @blockloop here's a solution that doesn't run on wake https://askubuntu.com/a/878579/477026 – qwr Apr 13 '18 at 18:13