TLP

From LinuxReviews
Jump to navigationJump to search
TLP
Original author(s)Thomas Koch
Repositorygithub.com/linrunner/TLP
Written in#/bin/sh
Operating systemLinux
TypePower Management
LicenseGNU GPL v2
Documentationlinrunner.de/tlp/
Laptop battery.png

TLP is a simple yet advanced power management script/utility for GNU/Linux that will adjust a lot of power-related settings when certain events like when AC power being disconnected or connected. It does not do any dynamic adjustments depending on system load or battery state or anything like that, it only applies settings on boot and when other clearly defined events take place. It does not have any GUI and it is not for novices. Power users may find it to be a useful tool.

TLP does not run as a daemon. It relies on systemd, udev and NetworkManager starting it when it should do something. It is important to know and understand this before you install it because it will do things once the package is installed regardless of what you think about that. The systemd service file is only relevant to it starting upon boot or not, it will trigger when USB devices are connected and when the system is suspended and resumed regardless if it is merely installed on a machine.

Configuration[edit]

TLP comes with a rather gigantic default configuration file in /etc/tlp.conf with pre-defined system defaults in /usr/share/tlp/defaults.conf in case settings are not set in the the by-default completely commented out /etc/tlp.conf configuration file. Settings can also be dropped in individual .conf files in /etc/tlp.d.

The default settings are mostly fine but there are some that are absolutely worth seriously considering before using TLP. For one, the default power setting for SATA is (in /usr/share/tlp/defaults.conf):

SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"

You should absolutely positively override that with:

File: /etc/tlp.d/nosatasuspend.conf
SATA_LINKPWR_ON_AC="max_performance"
SATA_LINKPWR_ON_BAT="max_performance"

..unless, of course, you are totally sure the combination of your motherboard and your SATA drive happens to have no issues with SATA power savings. Enabling SATA power saving causes random hangs on every laptop with a Intel chipset I've ever encountered. Perhaps your is different.

You will also want to consider if you really want the by-default USB_AUTOSUSPEND=1 setting enabled. TLP comes with a sneaky script placed in /usr/lib/udev/tlp-usb-udev that's executed when USB devices are connected and disconnected. It will set new USB devices to be auto-suspended when they are connected (existing ones at boot, too). Disabling power to a USB webcam (a laptops built-in webcam is likely connected using USB) is useful. Some piece of software disabling power to a remote controls IR receiver is extremely annoying and likely never desired or required. One does not have a remote control because one wants to go to the machine and type commands on the keyboard in order to get the remote control working. TLP does support blacklisting individual USB devices, so you can set most USB devices to auto-suspend and have those that should be kept alive stay alive.

Blacklisting USB auto-suspend can be done by checking the ID listed by lsusb. ID(s) can then be added to USB_BLACKLIST= in /etc/tlp.conf.

PCIe ASPM, PCI Express Active State Power Management, (PCIE_ASPM_ON_AC and PCIE_ASPM_ON_BAT) is another setting you may want to look at. Both default to system default. Setting one or both to powersave or powersupersave can save power but it can also cause problems with some Realtek network cards (newer kernels disable ASPM on most of those) so do be careful before you enable this setting.

There are a lot of other options you can change like CPU scaling governor, minimum frequencies, APM levels for hard drives and a lot more. You should totally look over /etc/tlp.conf and see what the defaults are and what non-defaults options you want to enable.

systemd support[edit]

TLP comes with a simple tlp.service file that will start it at boot and stop it upon shutdown. That's all the bundled systemd service file does. You can run the TLP script and enable it on each boot with:

systemctl enable --now tlp

TLP will activate on system suspend and resume on systems using systemd thanks to a systemd even hook placed in /lib/systemd/system-sleep/tlp which will happily execute regardless of the tlp.service being enabled or disabled or masked for that matter.

System Events[edit]

TLP will act on these events, and it will act on most of them as long as it is installed (unless you disable it with TLP_ENABLE=0 in /etc/tlp.conf):

Event How
Charger plugged in (AC powered) /usr/lib/udev/rules.d/85-tlp.rules
Charger unplugged (battery powered) /usr/lib/udev/rules.d/85-tlp.rules
USB device plugged in /usr/lib/udev/rules.d/85-tlp.rules
System startup (boot) tlp.service
System shutdown (power off) tlp.service
System reboot tlp.service
System suspend /usr/lib/systemd/system-sleep/tlp
System resume /usr/lib/systemd/system-sleep/tlp
LAN, Wi-Fi, WWAN connected/disconnected NetworkManager, optional. Requires the additional tlp-rdw package to be installed

Verdict And Conclusion[edit]

TLS is a nice script that can be used to tweak a whole lot of power-related settings. Is it is quite nice if you spend some time configuring it. The documentation at linrunner.de/tlp/ is pretty thorough.

What is absolutely not nice is how it starts doing all sorts of things by default once it is installed on a machine. It doesn't care if the tlp.service systemd service is enabled or not, not even a little (except for boot, reboot and shutdown activation which are enabled by that service file). What it does care about is this configuration option:

TLP_ENABLE=1

..which is set to 1 in /usr/share/tlp/defaults.conf and commented out in /etc/tlp.conf by default. That means it will, if you just install it and forget about it, change settings when AC is connected disconnected, when the machine hibernates or returns from suspend and when USB devices are connected. This may not be a big deal to you since you will probably not be installing TLP unless you want to use it but it is something no software should be doing.

TLP is worth a look if you want a script that will manage a whole lot of power-related settings for you and adjust settings when AC power is connected or disconnected. You will have to spend quite some time reading and likely changing the configuration file (/etc/tlp.conf or small personal per-feature settings files in /etc/tlp.d/) to get the most out of it.

TLP is in many ways a tool for power-users and the more tech-savvy, if you dive into the configuration file and you do not understand what two third of the settings do then you should perhaps uninstall it and leave things to your distributions defaults.


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.