BuddiesOfBudgie / budgie-desktop

Budgie Desktop is a familiar, modern desktop environment.
https://buddiesofbudgie.org
GNU General Public License v2.0
935 stars 48 forks source link

[Bug] Battery applet incorrectly indicates 100% charge (and connected power) #460

Open ehuelsmann opened 11 months ago

ehuelsmann commented 11 months ago

Description

The battery indicator says "100%" with the battery icon showing the plug on the side indicating the laptop is plugged in.

The problem: the laptop isn't plugged in and when checking "Power Settings" the battery is indicated at 46%, not 100%.

I see you asked output from tlp-stat and upower --dump. Here's the output:

# tlp-stat:
--- TLP 1.5.0 --------------------------------------------

+++ Configured Settings:
defaults.conf L0004: TLP_ENABLE="1"
defaults.conf L0005: TLP_WARN_LEVEL="3"
defaults.conf L0006: TLP_PERSISTENT_DEFAULT="0"
defaults.conf L0007: DISK_IDLE_SECS_ON_AC="0"
defaults.conf L0008: DISK_IDLE_SECS_ON_BAT="2"
defaults.conf L0009: MAX_LOST_WORK_SECS_ON_AC="15"
defaults.conf L0010: MAX_LOST_WORK_SECS_ON_BAT="60"
defaults.conf L0011: CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance"
defaults.conf L0012: CPU_ENERGY_PERF_POLICY_ON_BAT="balance_power"
defaults.conf L0013: SCHED_POWERSAVE_ON_AC="0"
defaults.conf L0014: SCHED_POWERSAVE_ON_BAT="1"
defaults.conf L0015: NMI_WATCHDOG="0"
defaults.conf L0016: DISK_DEVICES="nvme0n1 sda"
defaults.conf L0017: DISK_APM_LEVEL_ON_AC="254 254"
defaults.conf L0018: DISK_APM_LEVEL_ON_BAT="128 128"
defaults.conf L0019: DISK_APM_CLASS_DENYLIST="usb ieee1394"
defaults.conf L0020: DISK_IOSCHED="keep keep"
defaults.conf L0021: SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
defaults.conf L0022: SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
defaults.conf L0023: AHCI_RUNTIME_PM_ON_AC="on"
defaults.conf L0024: AHCI_RUNTIME_PM_ON_BAT="auto"
defaults.conf L0025: AHCI_RUNTIME_PM_TIMEOUT="15"
defaults.conf L0026: PCIE_ASPM_ON_AC="default"
defaults.conf L0027: PCIE_ASPM_ON_BAT="default"
defaults.conf L0028: RADEON_DPM_PERF_LEVEL_ON_AC="auto"
defaults.conf L0029: RADEON_DPM_PERF_LEVEL_ON_BAT="auto"
defaults.conf L0030: RADEON_POWER_PROFILE_ON_AC="default"
defaults.conf L0031: RADEON_POWER_PROFILE_ON_BAT="default"
defaults.conf L0032: WIFI_PWR_ON_AC="off"
defaults.conf L0033: WIFI_PWR_ON_BAT="on"
defaults.conf L0034: WOL_DISABLE="Y"
defaults.conf L0035: SOUND_POWER_SAVE_ON_AC="1"
defaults.conf L0036: SOUND_POWER_SAVE_ON_BAT="1"
defaults.conf L0037: SOUND_POWER_SAVE_CONTROLLER="Y"
defaults.conf L0038: BAY_POWEROFF_ON_AC="0"
defaults.conf L0039: BAY_POWEROFF_ON_BAT="0"
defaults.conf L0040: BAY_DEVICE="sr0"
defaults.conf L0041: RUNTIME_PM_ON_AC="on"
defaults.conf L0042: RUNTIME_PM_ON_BAT="auto"
defaults.conf L0043: RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau radeon"
defaults.conf L0044: USB_AUTOSUSPEND="1"
defaults.conf L0045: USB_EXCLUDE_AUDIO="1"
defaults.conf L0046: USB_EXCLUDE_BTUSB="0"
defaults.conf L0047: USB_EXCLUDE_PHONE="0"
defaults.conf L0048: USB_EXCLUDE_PRINTER="1"
defaults.conf L0049: USB_EXCLUDE_WWAN="0"
defaults.conf L0050: USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN="0"
defaults.conf L0051: RESTORE_DEVICE_STATE_ON_STARTUP="0"
defaults.conf L0052: RESTORE_THRESHOLDS_ON_BAT="0"
defaults.conf L0053: NATACPI_ENABLE="1"
defaults.conf L0054: TPACPI_ENABLE="1"
defaults.conf L0055: TPSMAPI_ENABLE="1"

+++ System Info
System         = TUXEDO Standard TUXEDO Pulse 15 Gen1
BIOS           = N.1.07.A05
OS Release     = Ubuntu 22.04.3 LTS
Kernel         = 6.2.0-10022-tuxedo #28 SMP PREEMPT_DYNAMIC Wed Aug 23 20:17:32 UTC 2023 x86_64
/proc/cmdline  = BOOT_IMAGE=/boot/vmlinuz-6.2.0-10022-tuxedo root=UUID=aab3f257-5b69-4884-8b61-65b4d604f07e ro quiet splash xhci_hcd.quirks=1073741824 vt.handoff=7
Init system    = systemd v249 (249.11-0ubuntu3.10)
Boot mode      = UEFI

+++ TLP Status
State          = enabled
RDW state      = not installed
Last run       = 18:17:43,    367 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 4800H with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = acpi-cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = ondemand
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =  1400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  2900000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies = 2900000 1700000 1400000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = 0

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = (not available)
/sys/firmware/acpi/platform_profile_choices            = (not available)

+++ Temperatures
Fan speed              = (not available)

+++ File System
/proc/sys/vm/laptop_mode               =     2
/proc/sys/vm/dirty_writeback_centisecs =  6000
/proc/sys/vm/dirty_expire_centisecs    =  6000
/proc/sys/vm/dirty_ratio               =    20
/proc/sys/vm/dirty_background_ratio    =    10

+++ Disks
Devices = nvme0n1 sda

/dev/nvme0n1:
  Type       = NVMe
  Disk ID    = nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0R201993L
  Model      = Samsung SSD 980 PRO 1TB                 
  Firmware   = 2B2QGXA7
  Temp       = 28 °C
  Scheduler  = [none] mq-deadline (multi queue)

  Runtime PM:
    /sys/block/nvme0n1/device/power/control = auto, autosuspend_delay_ms = (not available)

  SMART info:
    Critical Warning:                   0x00
    Temperature:                        28 Celsius
    Available Spare:                    100%
    Available Spare Threshold:          10%
    Percentage Used:                    2%
    Data Units Written:                 25.323.325 [12,9 TB]
    Power Cycles:                       3.382
    Power On Hours:                     1.999
    Unsafe Shutdowns:                   179
    Media and Data Integrity Errors:    0

/dev/sda: not present.

+++ AHCI Link Power Management (ALPM) :: SATA Links
/sys/bus/pci/devices/0000:05:00.0/ata1/host0/scsi_host/host0/link_power_management_policy = med_power_with_dipm 
/sys/bus/pci/devices/0000:05:00.1/ata2/host1/scsi_host/host1/link_power_management_policy = med_power_with_dipm 

+++ AHCI Port Runtime Power Management :: SATA/ATA Ports
/sys/bus/pci/devices/0000:05:00.0/ata1/power/control     = auto 
/sys/bus/pci/devices/0000:05:00.1/ata2/power/control     = auto 

+++ AMD Radeon Graphics
/sys/class/drm/card0/device/driver                                = amdgpu

/sys/class/drm/card0/device/power_dpm_force_performance_level     = auto

+++ Wireless
bluetooth = on
nfc       = none (no device)
wifi      = on
wwan      = none (no device)

hci0(btusb)                   : bluetooth, connected
wlp1s0(iwlwifi)               : wifi, connected, power management = off

+++ Audio
/sys/module/snd_hda_intel/parameters/power_save            = 1
/sys/module/snd_hda_intel/parameters/power_save_controller = Y

+++ PCIe Active State Power Management
/sys/module/pcie_aspm/parameters/policy = [default] performance powersave powersupersave

+++ PCIe Runtime Power Management
Enable devices    = (disabled)
Disable devices   = (disabled)
Device denylist   = (disabled)
Driver denylist   = mei_me nouveau radeon

/sys/bus/pci/devices/0000:00:00.0/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:00.2/power/control = auto (0x080600, IOMMU, no driver)
/sys/bus/pci/devices/0000:00:01.0/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:01.2/power/control = auto (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:01.3/power/control = auto (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:02.0/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:02.4/power/control = auto (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:08.0/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:08.1/power/control = auto (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:08.2/power/control = auto (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:14.0/power/control = auto (0x0c0500, SMBus, piix4_smbus)
/sys/bus/pci/devices/0000:00:14.3/power/control = auto (0x060100, ISA bridge, no driver)
/sys/bus/pci/devices/0000:00:18.0/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.1/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.2/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.3/power/control = auto (0x060000, Host bridge, k10temp)
/sys/bus/pci/devices/0000:00:18.4/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.5/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.6/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:18.7/power/control = auto (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:01:00.0/power/control = auto (0x028000, Network controller, iwlwifi)
/sys/bus/pci/devices/0000:02:00.0/power/control = auto (0x020000, Ethernet controller, r8169)
/sys/bus/pci/devices/0000:03:00.0/power/control = auto (0x010802, Non-Volatile memory controller, nvme)
/sys/bus/pci/devices/0000:04:00.0/power/control = auto (0x030000, VGA compatible controller, amdgpu)
/sys/bus/pci/devices/0000:04:00.1/power/control = auto (0x040300, Audio device, snd_hda_intel)
/sys/bus/pci/devices/0000:04:00.2/power/control = auto (0x108000, Encryption controller, ccp)
/sys/bus/pci/devices/0000:04:00.3/power/control = auto (0x0c0330, USB controller, xhci_hcd)
/sys/bus/pci/devices/0000:04:00.4/power/control = auto (0x0c0330, USB controller, xhci_hcd)
/sys/bus/pci/devices/0000:04:00.5/power/control = auto (0x048000, Multimedia controller, no driver)
/sys/bus/pci/devices/0000:04:00.6/power/control = auto (0x040300, Audio device, snd_hda_intel)
/sys/bus/pci/devices/0000:05:00.0/power/control = auto (0x010601, SATA controller, ahci)
/sys/bus/pci/devices/0000:05:00.1/power/control = auto (0x010601, SATA controller, ahci)

+++ USB
Autosuspend       = enabled
Device allowlist  = (not configured)
Device denylist   = (not configured)
Exclude audio     = enabled
Exclude bluetooth = disabled
Exclude phones    = disabled
Exclude printers  = enabled
Exclude WWAN      = disabled

Bus 004 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 3.0 root hub (hub)
Bus 003 Device 002 ID 1050:0407 control = on,   autosuspend_delay_ms = 2000 -- Yubico.com Yubikey 4/5 OTP+U2F+CCID (usbhid, usbfs)
Bus 003 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 2.0 root hub (hub)
Bus 002 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 3.0 root hub (hub)
Bus 001 Device 005 ID 8087:0029 control = auto, autosuspend_delay_ms = 2000 -- Intel Corp. AX200 Bluetooth (btusb)
Bus 001 Device 004 ID 0bda:0129 control = auto, autosuspend_delay_ms = 2000 -- Realtek Semiconductor Corp. RTS5129 Card Reader Controller (rtsx_usb)
Bus 001 Device 003 ID 05e3:0608 control = auto, autosuspend_delay_ms =    0 -- Genesys Logic, Inc. Hub (hub)
Bus 001 Device 002 ID 04f2:b68b control = auto, autosuspend_delay_ms = 2000 -- Chicony Electronics Co., Ltd HD Webcam (uvcvideo)
Bus 001 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 2.0 root hub (hub)

+++ Battery Care
Plugin: asus
Supported features: none available
Driver usage:
* natacpi (asus_wmi) = inactive (laptop not supported)

+++ Battery Status: BAT0
/sys/class/power_supply/BAT0/manufacturer                   = OEM
/sys/class/power_supply/BAT0/model_name                     = standard
/sys/class/power_supply/BAT0/cycle_count                    =      0 (or not supported)
/sys/class/power_supply/BAT0/charge_full_design             =   7900 [mAh]
/sys/class/power_supply/BAT0/charge_full                    =   6100 [mAh]
/sys/class/power_supply/BAT0/charge_now                     =   2806 [mAh]
/sys/class/power_supply/BAT0/current_now                    =    749 [mA]
/sys/class/power_supply/BAT0/status                         = Discharging

Charge                                                      =   46.0 [%]
Capacity                                                    =   77.2 [%]

And here's the output of upower --dump run at the same time:

Device: /org/freedesktop/UPower/devices/line_power_AC0
  native-path:          AC0
  power supply:         yes
  updated:              za 23 sep 2023 18:17:43 CEST (420 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               OEM
  model:                standard
  serial:               00001
  power supply:         yes
  updated:              za 23 sep 2023 18:23:43 CEST (60 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              32,4093 Wh
    energy-empty:        0 Wh
    energy-full:         70,455 Wh
    energy-full-design:  91,245 Wh
    energy-rate:         6,29475 W
    voltage:             11,064 V
    charge-cycles:       N/A
    time to empty:       5,1 hours
    percentage:          46%
    capacity:            77,2152%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (rate):
    1695486223  6,295   discharging

Device: /org/freedesktop/UPower/devices/mouse_dev_EF_1B_5E_F1_BF_F9
  native-path:          /org/bluez/hci0/dev_EF_1B_5E_F1_BF_F9
  model:                MX Anywhere 2
  serial:               EF:1B:5E:F1:BF:F9
  power supply:         no
  updated:              za 23 sep 2023 18:17:50 CEST (413 seconds ago)
  has history:          yes
  has statistics:       no
  mouse
    present:             yes
    rechargeable:        no
    state:               unknown
    warning-level:       none
    percentage:          20%
    icon-name:          'battery-missing-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              za 23 sep 2023 18:23:43 CEST (60 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              32,4093 Wh
    energy-full:         70,455 Wh
    energy-rate:         6,29475 W
    charge-cycles:       N/A
    time to empty:       5,1 hours
    percentage:          46%
    icon-name:          'battery-good-symbolic'

Daemon:
  daemon-version:  0.99.17
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep

As you can see, both indicate 46% as does the "power settings" window.

Budgie version

budgie-desktop 10.6.1

Operating System

Ubuntu 22.04.3 LTS

Steps to reproduce the issue

To be honest, I have no idea how to reproduce. It happens every now and then. It definitely doesn't happen all the time.

It has to do - I think with decoupling the charger while the laptop is asleep.

Actual result

image

Expected result

The battery icon in "discharging" state, with a battery percentage of 46%.

(After reboot, it shows: image )

Additional information

# uname -a
Linux tuxedo 6.2.0-10022-tuxedo #28 SMP PREEMPT_DYNAMIC Wed Aug 23 20:17:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:    22.04
Codename:   jammy

Please ask for more if you need it.

fossfreedom commented 11 months ago

Please remove tlp and reboot. We need to check if tlp is interfering with the power values.

ehuelsmann commented 11 months ago

Done:

# apt remove tlp
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libappindicator1
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  tlp
0 upgraded, 0 newly installed, 1 to remove and 5 not upgraded.
After this operation, 581 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 730307 files and directories currently installed.)
Removing tlp (1.5.0-1ubuntu3) ...
Processing triggers for man-db (2.10.2-1) ...

# apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  libappindicator1
0 upgraded, 0 newly installed, 1 to remove and 5 not upgraded.
After this operation, 99,3 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 730236 files and directories currently installed.)
Removing libappindicator1 (12.10.1+20.10.20200706.1-0ubuntu1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.3) ...
ehuelsmann commented 11 months ago

My laptop got stuck in the same state again:

image

This time, tlp isn't installed:

# apt remove tlp
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'tlp' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

upower --dump again:

# upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC0
  native-path:          AC0
  power supply:         yes
  updated:              za 30 sep 2023 12:43:45 CEST (8319 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               OEM
  model:                standard
  serial:               00001
  power supply:         yes
  updated:              za 30 sep 2023 15:01:45 CEST (39 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              37,3412 Wh
    energy-empty:        0 Wh
    energy-full:         70,455 Wh
    energy-full-design:  91,245 Wh
    energy-rate:         7,86555 W
    voltage:             11,14 V
    charge-cycles:       N/A
    time to empty:       4,7 hours
    percentage:          53%
    capacity:            77,2152%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (rate):
    1696078905  7,866   discharging

Device: /org/freedesktop/UPower/devices/mouse_dev_EF_1B_5E_F1_BF_F9
  native-path:          /org/bluez/hci0/dev_EF_1B_5E_F1_BF_F9
  model:                MX Anywhere 2
  serial:               EF:1B:5E:F1:BF:F9
  power supply:         no
  updated:              za 30 sep 2023 12:43:56 CEST (8308 seconds ago)
  has history:          yes
  has statistics:       no
  mouse
    present:             yes
    rechargeable:        no
    state:               unknown
    warning-level:       none
    percentage:          50%
    icon-name:          'battery-missing-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              za 30 sep 2023 15:01:45 CEST (39 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              37,3412 Wh
    energy-full:         70,455 Wh
    energy-rate:         7,86555 W
    charge-cycles:       N/A
    time to empty:       4,7 hours
    percentage:          53%
    icon-name:          'battery-good-symbolic'

Daemon:
  daemon-version:  0.99.17
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep

Budgie desktop unchanged:

# budgie-desktop --version
budgie-desktop 10.6.1
Copyright © 2014-2022 Budgie Desktop Developers
# uname -a
Linux tuxedo 6.2.0-10022-tuxedo #28 SMP PREEMPT_DYNAMIC Wed Aug 23 20:17:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Any other info I can add to help resolve this state? This time, I left the widget in the stuck state (last time I reset it, to check that the remediation in the other issue worked for me too).