Linux is a highly customizable and efficient operating system, that is the main reason why servers and critical computers use Linux. But one of the challenges users often face, especially on laptops, is maximizing battery life.
While modern Linux distributions have come a long way in improving power profile management, advanced users looking to squeeze every last drop of battery life can take advantage of tools like TLP. Although, in Gnome desktop environment, power-profile-daemon
is the default available tool, but that doesn’t save much.
TLP is a powerful, easy-to-use tool that optimizes battery usage on Linux laptops by adjusting power settings automatically. Whether you’re using a ThinkPad or another type of laptop, TLP can help extend battery life without requiring you to manually tweak various system settings. The default settings in it are well optimized.
Here’s a simple guide on how to install, configure, and use TLP to optimize your Linux laptop battery. I assume you know a little-bit of command line interface.
1. Why Use TLP?
Linux distributions often provide basic power management settings, but they don’t always go deep enough to ensure efficient battery usage. It is because Linux is designed for critical work and should not fail when needed, the most.
But in consumer level hardware, especially in laptops and battery backed computers, most of us don’t need this performance, however a default power-profile-daemon
is there to save some battery power, but that too is very minimal.
TLP works under the hood to tweak a variety of settings, including CPU frequency scaling, power states, disk power management, and more. Unlike manual methods, TLP does all the heavy lifting automatically, making it a set-it-and-forget-it solution.
Key Features of TLP:
- CPU Power Management: Adjusts CPU power states and frequency scaling to save power. Most of the savings are done here as CPU is the biggest energy drainer.
- Disk Management: Controls how hard disks spin down, reducing power usage when idle. Savings are marginal on modern hardware but noticeable.
- Battery Care: For some laptops, TLP includes battery thresholds, helping to prolong battery lifespan by avoiding unnecessary full charges.
- Network Power Savings: Optimizes Wi-Fi and Ethernet power consumption.
- USB Autosuspend: Disables unused USB devices to save power.
I also recommend you to use optimal brightness levels to save even more. If possible, work on dim light section to avoid the need of high brightness levels.
2. Installing TLP.
Installing TLP is straightforward and works across many popular Linux distributions.
For Debian-based and Ubuntu-based distributions:
Open your terminal and run the following commands:
sudo apt update
sudo apt install tlp tlp-rdw
For Fedora-based distributions:
sudo dnf install tlp tlp-rdw
For Arch-based distributions:
sudo pacman -S tlp
Starting TLP:
Once TLP is installed, start it with:
sudo tlp start
TLP will automatically start at boot, so you don’t need to manually start it each time.
3. Configuring TLP.
Out of the box, TLP provides good defaults for most users. However, for those who want to dive deeper into power management, you can configure it by editing the configuration file.
Editing the TLP Configuration File:
The configuration file is located at /etc/tlp.conf
.
You can open it with any text editor:
sudo nano /etc/tlp.conf
The file is well-documented with comments explaining each setting, so you can adjust them based on your preferences.
You can create a custom configuration file inside the /etc/tlp.d/
directory (the file name must end with .conf
), and it will use that in addition to the main one.
Some of the key options you might want to tweak include:
- CPU frequency scaling (
CPU_SCALING_GOVERNOR
): TLP can adjust the CPU frequency governor to use less power when the system is idle. Set this to “powersave” for better battery life or “performance” for maximum speed. - Disk Power Management (
DISK_DEVICES
): TLP can spin down idle hard drives to save power. This setting is particularly useful for laptops with traditional spinning hard drives, though SSDs also benefit from power-saving modes. - Wi-Fi Power Saving (
WIFI_PWR_ON_BAT
): This option reduces Wi-Fi power consumption when running on battery, especially useful if you’re frequently working in places with weaker signals.
Once you’ve made your changes, save the file and restart TLP with:
sudo tlp restart
4. Monitoring TLP
After configuring TLP, you may want to monitor its activity to ensure that it’s working as expected. TLP provides a command to check the status of its power-saving features:
sudo tlp-stat
This command outputs detailed information about your system’s power usage, the current TLP settings, and how they are affecting your laptop’s power consumption. You can use this information to fine-tune settings further or ensure everything is running smoothly.
You can also use various flags to fetch the specific information like:
Use -s
flag for system information. [Most used]
atulkumarpandey@debian:~$ sudo tlp-stat -s
--- TLP 1.5.0 --------------------------------------------
+++ System Info
System = LENOVO IdeaPad Slim 5 14IRL8 82XD
BIOS = LACN36WW
OS Release = Debian GNU/Linux 12 (bookworm)
Kernel = 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64
/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-6.1.0-26-amd64 root=UUID=99e3ca4f-7fde-47db-87e0-4520b17b4189 ro quiet
Init system = systemd v252 (252.30-1~deb12u2)
Boot mode = UEFI
+++ TLP Status
State = enabled
RDW state = enabled
Last run = 11:04:07 AM IST, 923 sec(s) ago
Mode = AC
Power source = AC
Use -c
flag for current configured settings.
atulkumarpandey@debian:~$ sudo tlp-stat -c
--- 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"
Use -b
flag for battery care information.
atulkumarpandey@debian:~$ sudo tlp-stat -b
--- TLP 1.5.0 --------------------------------------------
+++ Battery Care
Plugin: lenovo
Supported features: charge threshold
Driver usage:
* vendor (ideapad_laptop) = active (charge threshold)
Parameter value range:
* STOP_CHARGE_THRESH_BAT0: 0(off), 1(on) -- battery conservation mode
/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode = 0 (100%)
+++ Battery Status: BAT1
/sys/class/power_supply/BAT1/manufacturer = BYD
/sys/class/power_supply/BAT1/model_name = L22B3PA4
/sys/class/power_supply/BAT1/cycle_count = 26
/sys/class/power_supply/BAT1/energy_full_design = 56600 [mWh]
/sys/class/power_supply/BAT1/energy_full = 56590 [mWh]
/sys/class/power_supply/BAT1/energy_now = 55320 [mWh]
/sys/class/power_supply/BAT1/power_now = 9884 [mW]
/sys/class/power_supply/BAT1/status = Charging
Charge = 97.8 [%]
Capacity = 100.0 [%]
Use the -t
flag for temperatures information. [Often used]
atulkumarpandey@debian:~$ sudo tlp-stat -t
--- TLP 1.5.0 --------------------------------------------
+++ Temperatures
CPU temp = 46 [°C]
Fan speed = (not available)
Use the -w flag for warnings.
atulkumarpandey@debian:~$ sudo tlp-stat -w
--- TLP 1.5.0 --------------------------------------------
No warnings detected.
To know more, simply use --help
flag, and it will show all commands at once.
atulkumarpandey@debian:~$ sudo tlp-stat --help
Usage: tlp-stat [ -b | --battery | -c | --config |
-d | --disk | -e | --pcie |
-g | --graphics | -p | --processor |
-r | --rfkill | -s | --system |
-t | --temp | -u | --usb |
-w | --warn | -v | --verbose |
| --cdiff | | --pev |
-P | --psup | -T | --trace |
| --udev ]
This is how you can monitor everything here.
5. Advanced Tips.
Battery Care Features:
For laptops that support it (especially Lenovo ThinkPads), TLP allows you to control battery charge thresholds. This feature lets you set limits on battery charging to avoid constantly charging the battery to 100%, which can wear it out faster over time. For example, you can configure the battery to only charge up to 80%, which prolongs battery health.
To enable this, find the following settings in /etc/tlp.conf
:
# Battery charge thresholds (for supported hardware)
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=85
USB Autosuspend:
TLP can automatically suspend unused USB devices when running on battery power. This is especially helpful for external peripherals like USB mice or flash drives that are plugged in but not in use.
To enable USB autosuspend, look for this setting in the configuration file:
USB_AUTOSUSPEND=1
6. Conclusion.
TLP is an incredibly effective tool for optimizing battery life on Linux laptops. It provides powerful and automated power management features that require minimal user intervention. Even I use it on my all Linux machines that run on battery.
By installing and configuring TLP, you can significantly extend your laptop’s battery life while ensuring that you’re still getting the performance you need when plugged in.
While the default settings are sufficient for most users, more advanced users can tweak TLP further to suit their specific needs. Whether you want to maximize performance, extend battery life, or balance the two, TLP gives you the tools to make it happen.
Now that you have TLP set up, you can enjoy better battery life and a more portable Linux experience without worrying about running out of power too soon.
Leave a Reply