My device is Asus VivoBook S531FL. On Windows, MyAsus app allows to set battery charging threshold(e.g. 60%, 80%, 100%). There is no option to set this limit in BIOS. I created a systemd service to set the desired threshold. It used to work fine. But after recent updates to Manjaro and KDE Plasma, it stopped working. It says [FAILED] Failed to start battery-charge-threshold.service at startup before login screen comes up. I tried reloading the daemon and restarting the service. But no luck. I have also tried deleting the battery-charge-threshold.service and recreating it. But nothing works. Please help me to resolve this problem. I am very new to Manjaro(Arch). I never encountered this issue on Debian based distros.
Steps I followed to create the systemd service:
sudo nano /etc/systemd/system/battery-charge-threshold.service
- Wrote following lines in the file
Description=Set the battery charge threshold
ExecStart=/bin/bash -c ‘echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold’
sudo systemctl enable battery-charge-threshold.service
sudo systemctl start battery-charge-threshold.service
- To reload I used
sudo systemctl daemon-reload
sudo systemctl restart battery-charge-threshold.service
What’s the error message of the service?
systemctl status battery-charge-threshold.service
journalctl -u battery-charge-threshold.service
Use valid path
/etc/systemd/ where are created symlinks.
/usr is for package-provided files,
/etc is for files from the system administrator. Source: systemd - ArchWiki
Also this comes up while booting:[please go to this address. The forum is not allowing to post any image or link] h t t p s : / / sajidifti . com / failed . jpg
The log you gave indicates that it works but in your screenshot it doesn’t.
The log of the failed case is important and you have to provide it.
What can I do now? It works sometimes, sometimes it doesn’t. When it works, the plasma battery icon says that although the power adapter is connected, the battery is still draining and the adapter is not providing enough power. I am confused and frustrated at this point.
By the way, thanks for looking into this.
Maybe the file is not created by the driver yet when the script is run? Have you tried putting adding some delay?
No. Good idea though. Will definitely try.
You were right. Adding some delay fixed the problem with 99% success rate. I have added 10 sec delay. The problem was caused by the slow launch of multi-user.target. I have added the following line to my original script
It fixed the [FAILED] Failed to start battery-charge-threshold.service issue at startup. It also fixed the misbehavior of the service after booting into the desktop. However, plasma battery icon sometimes says that Battery at 80% But Still Discharging. The Power Supply Is Not Powerful Enough To Charge The Battery.. This is no biggie. I am happy that the service is working.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.