Battery charge limit setting lost after reboot

Hi all,

I’ve set battery charge limit to 80% in System Settings->Power Management->Advanced Power Settings and it works ok.
But after reboot the value is set to 100% again.

After some googling I’ve tried tlpui as suggested here https://forum.manjaro.org/t/set-battery-charge-limit/141978/9 with no success.
Also I noticed that there is file /sys/class/power_supply/BAT0/charge_control_end_threshold which contains the value currently set up but no files /sys/class/power_supply/BAT0/charge_start_threshold and /sys/class/power_supply/BAT0/charge_stop_threshold which are mentioned in https://forum.manjaro.org/t/laptop-battery-charging-limit/138704/2.

How to make this setting persistent?

I’m on Asus Vivobook X1600

#inxi --full --admin --filter --width                                                                                                                                                                                         ✔ 
System:
  Kernel: 6.5.5-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.5-x86_64
    root=UUID=c63c1103-44d6-49f9-9e89-2e8b6c227d13 rw quiet splash
    resume=UUID=b87ef437-5c75-4b35-ab51-7dae2b0b449f udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.8 tk: Qt v: 5.15.11 wm: kwin_x11 vt: 2 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: Vivobook_ASUSLaptop X1603ZA_X1603ZA
    v: 1.0 serial: <superuser required>
  Mobo: ASUSTeK model: X1603ZA v: 1.0 serial: <superuser required>
    UEFI: American Megatrends LLC. v: X1603ZA.303 date: 09/07/2022
Battery:
  ID-1: BAT0 charge: 45.6 Wh (90.3%) condition: 50.5/50.0 Wh (101.1%)
    volts: 12.7 min: 11.9 model: ASUSTeK ASUS Battery type: Li-ion serial: N/A
    status: not charging cycles: 4
CPU:
  Info: model: 12th Gen Intel Core i7-12700H bits: 64 type: MST AMCP
    arch: Alder Lake gen: core 12 level: v3 note: check built: 2021+
    process: Intel 7 (10nm ESF) family: 6 model-id: 0x9A (154) stepping: 3
    microcode: 0x42C
  Topology: cpus: 1x cores: 14 mt: 6 tpc: 2 st: 8 threads: 20 smt: enabled
    cache: L1: 1.2 MiB desc: d-8x32 KiB, 6x48 KiB; i-6x32 KiB, 8x64 KiB
    L2: 11.5 MiB desc: 6x1.2 MiB, 2x2 MiB L3: 24 MiB desc: 1x24 MiB
  Speed (MHz): avg: 470 high: 933 min/max: 400/4600:4700:3500 scaling:
    driver: intel_pstate governor: powersave cores: 1: 400 2: 400 3: 400 4: 932
    5: 400 6: 933 7: 400 8: 400 9: 400 10: 400 11: 749 12: 400 13: 400 14: 400
    15: 400 16: 400 17: 400 18: 400 19: 400 20: 400 bogomips: 107560
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Enhanced / Automatic IBRS, IBPB: conditional,
    RSB filling, PBRSB-eIBRS: SW sequence
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Alder Lake-P GT2 [Iris Xe Graphics] vendor: ASUSTeK
    driver: i915 v: kernel arch: Gen-12.2 process: Intel 10nm built: 2021-22+
    ports: active: eDP-1 empty: HDMI-A-1 bus-ID: 0000:00:02.0
    chip-ID: 8086:46a6 class-ID: 0300
  Device-2: IMC Networks USB2.0 HD UVC WebCam driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-9:3 chip-ID: 13d3:5463
    class-ID: fe01 serial: <filter>
  Display: x11 server: X.Org v: 21.1.8 compositor: kwin_x11 driver: X:
    loaded: modesetting alternate: fbdev,vesa dri: iris gpu: i915 display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 1920x1200 s-dpi: 96 s-size: 508x317mm (20.00x12.48")
    s-diag: 599mm (23.57") monitors: <missing: xrandr>
  Monitor-1: eDP-1 model: AU Optronics 0x459d built: 2022 res: 1920x1200
    dpi: 142 gamma: 1.2 size: 344x215mm (13.54x8.46") diag: 406mm (16")
    ratio: 16:10 modes: 1920x1200
  API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris
    device: 1 drv: swrast surfaceless: drv: iris x11: drv: iris
    inactive: gbm,wayland
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel Graphics (ADL GT2)
    device-ID: 8086:46a6 memory: 11.12 GiB unified: yes
  API: Vulkan v: 1.3.264 layers: N/A device: 0 type: integrated-gpu
    name: Intel Graphics (ADL GT2) driver: mesa intel v: 23.1.9-manjaro1.1
    device-ID: 8086:46a6 surfaces: xcb,xlib
Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel alternate: snd_sof_pci_intel_tgl
    bus-ID: 0000:00:1f.3 chip-ID: 8086:51c8 class-ID: 0403
  API: ALSA v: k6.5.5-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.81 status: off with: pipewire-media-session
    status: active tools: pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Intel Alder Lake-P PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 0000:00:14.3 chip-ID: 8086:51f0 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-10:4 chip-ID: 8087:0026
    class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
    v: 0.6 port: N/A bus-ID: 0000:00:0e.0 chip-ID: 8086:467f rev: class-ID: 0104
Drives:
  Local Storage: total: 476.94 GiB used: 25.41 GiB (5.3%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron model: 2210 MTFDHBA512QFD
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: P6MA007 temp: 36.9 C
    scheme: GPT
Partition:
  ID-1: / raw-size: 118.1 GiB size: 115.69 GiB (97.96%) used: 25.41 GiB (22.0%)
    fs: ext4 dev: /dev/nvme0n1p8 maj-min: 259:8
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 288 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p6 maj-min: 259:6
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: partition size: 2 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/nvme0n1p7 maj-min: 259:7
Sensors:
  System Temperatures: cpu: 46.0 C mobo: N/A
  Fan Speeds (rpm): cpu: 2100
Info:
  Processes: 361 Uptime: 6h 35m wakeups: 4953 Memory: total: 12 GiB note: est.
  available: 11.38 GiB used: 5.17 GiB (45.4%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: pm: pacman pkgs: 1384 libs: 367 tools: pamac pm: flatpak pkgs: 0
  Shell: Zsh v: 5.9 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.30

Hi @sgrin, and welcome!

In order for us, or anyone for that matter, to be able to provide assistance, more information is necessary. To that end, please see:

Please also note and heed: Forum Rules - Manjaro

Hope you manage!


:bangbang: Tip: :bangbang:

To provide terminal output, copy the text you wish to share, and paste it here, surrounded by three (3) backticks, a.k.a grave accents. Like this:

```
pasted text
```

Or three (3) tilde signs, like this:

~~~
pasted text
~~~

This will just cause it to be rendered like this:

Portaest sed
elementum
cursus nisl nisi
hendrerit ac quis
sit
adipiscing
tortor sit leo commodo.

Instead of like this:

Portaest sed elementum cursus nisl nisi hendrerit ac quis sit adipiscing tortor sit leo commodo.

Alternatively, paste the text you wish to format as terminal output, select all pasted text, and click the </> button on the taskbar. This will indent the whole pasted section with one TAB, causing it to render the same way as described above.

Thereby improving legibility and making it much easier for those trying to be of assistance.


:bangbang::bangbang: Additionally

If your language isn’t English, please prepend any and all terminal commands with LC_ALL=C. For example:

LC_ALL=C bluetoothctl

This will just cause the terminal output to be in English, making it easier to understand and debug.

Please edit your post accordingly.

If your machine is a Lenovo, commands similar to these might suffice:

sudo tpacpi-bat -g 1 80
sudo tpacpi-bat -g 2 80

Successful completion depends on having tlp and tpacpi-bat installed:

sudo pacman -S tlp tpacpi-bat

You might have success creating a Systemd service to persist the settings, although this should not normally be necessary. Again, this example is for Lenovo laptops;

Create and edit a service file using your favourite text editor; for example, something like:

sudo nano /etc/systemd/system/battery-charge-threshold.service

Add the following content:

[Unit]
Description=Set battery charge thresholds

[Service]
Type=oneshot
ExecStart=/usr/bin/tpacpi-bat -g 1 60
ExecStart=/usr/bin/tpacpi-bat -g 2 80

[Install]
WantedBy=multi-user.target

Save the file, and then enable the service:

sudo systemctl enable battery-charge-threshold.service

For any other brand of laptop :person_shrugging:

Be mindful that this may not work on all laptops:

This is extremely model dependent, the interfaces in the sys vary greatly. Tell us your Laptop exact model.

While Plasma may offer tho optione - not all devices supports it - unfortunately

Most probably your device does not support thresholding.

You cannot if your device does not support it.

A custom script is another option for devices which do not support a threshold.

1 Like

https://wiki.archlinux.org/title/Category:Laptops

This page is your best friend. For example, for ideapads, but not thinkpads, it will be

echo 1| sudo /usr/bin/tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

It is different for thinkpads, Acer and others. I doubt Plasma detects it always correctly for all models, so you have interface that does…nothing, most plobably.

1 Like

Thanks a lot!

Solved by reading https://wiki.archlinux.org/title/Category:ASUS, installing asusctl(AUR) and running asusctl -c 80

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.