For Linux laptop running without power supply, it will automatically go sleep when battery running into critical low. In case, you want to configure when the battery is critical low, and which action to do, this simple may help!
NOTE: This tutorial is tested and works in Ubuntu 22.04, Ubuntu 22.10, XUbuntu 22.04, Linux Mint 21 Cinnamon, Fedora 37 workstation, and Manjaro GNOME. It may also work in many other Linux, though KDE desktop has its own configure option to do the job.
Step 1: Edit UPower config file
UPower is the power management service for GNOME. It also works in XFCE and Cinnamon desktop.
1. Firstly, search for and open a terminal window from either start menu or ‘Activities’ overview depends on your desktop environment.
2. When terminal opens, run command to edit the UPower config file:
sudo gedit /etc/UPower/UPower.conf
For Ubuntu 22.10+, Fedora workstation, replace
gnome-text-editor. For Linux Mint, use
xed. Or use
nano text editor that works in most Linux.
3. When file opens, scroll down and find out the line:
Replace “HybridSleep” to configure the battery critical low action. As the file indicates, possible values include:
- Hibernate – Your system must support hibernate (enable hibernate in Mint), or PowerOff will be in use.
4. As the last screenshot shows you, you can also change the number in the following lines:
Meaning battery is low when only 20% percentage left, critical low when 5% left, and perform action when 2% left. Change the value as you prefer.
5. (Optional) If you want to use battery remaining time instead of percentage, do:
- Find out and set UsePercentageForPolicy=false
- Configure the number in seconds of following lines:
After making changes, save and close the file. For
nano command line text editor, press Ctrl+X, type y and finally hit Enter to save.
Step 2: Apply changes
After editing the UPower settings, either restart your computer to apply it.
Or, open terminal and run command to restart the system service:
sudo systemctl restart upower.service
To check its status, use
systemctl status upower.service command. That’s all, enjoy!