There used to be a time when Linux on the laptop meant putting up with cooling fans whirring away at full speed, while your machine was sucking its battery empty in record time. If you wanted proper support for all the fancy advanced power management that mobile processors had to offer, you were stuck with Windows.
Those days have been over for a while now though, particularly when you own a reasonably well supported machine. In which case Linux can and will actually outperform Windows quite noticeably in terms of battery endurance, and sustained compute performance when plugged into AC power.
Please read our disclaimer carefully before considering to proceed with this guide.
Most of the suggestions we provide should work with other current generation Intel laptops, but some are ThinkPad specific. We shall try to point that out where applicable. This guide assumes you are running a recent version of Ubuntu, either 18.04 or 20.04 desktop, on your machine, but then again, most things can be made to work with other distributions too. We shall split this one into two sections:
1) Making your ThinkPad run longer and preserving battery health:
TLP combines the manipulation of all modern power management functions of laptop hardware into one application and config file. It significantly improves run time. Particularly if you are willing to de-tune your system and under clock it while running on battery. Given the performance reserves most modern CPUs have this is entirely reasonable for normal office and web browsing workloads.
On most ThinkPad laptops TLP will also allow you to set battery charge thresholds. Under Windows the Lenovo Vantage tool provides similar functionality. What's the benefit of not charging the battery to full capacity every time? Charging only to e.g. 85% and then stopping the charging process, even if the machine remains plugged into AC power, significantly prolongs the useful life of a battery pack, particular on machines that spend most their life as desktop replacements plugged into a charger 24/7. Electric vehicles use the same technique to prolong the service life of their battery packs. You can always temporarily raise or remove the charge threshold and charge to 100% if you need every last mWh of power for that extra long flight or road trip.
Setting it up, use the project PPA to get the most recent version:
sudo add-apt-repository ppa:linrunner/tlpsudo apt-get update
Install the following packages:
- tlp (PPA or universe) – Power saving
- tlp-rdw (PPA or universe) – optional, Radio Device Wizard
The above works for most laptops, the following is ThinkPad specific and enables some valuable extra functionality. Quoting from the project website:
"Depending on your model and kernel version external kernel module(s) are required to provide battery charge thresholds and recalibration.
The output of tlp-stat -b (version 1.2.2 or higher recommended) will guide you which package to install:
- acpi-call-dkms (universe) – optional – External kernel module providing battery charge thresholds and recalibration for newer ThinkPads (X220/T420 and later)
- tp-smapi-dkms (PPA or universe) – optional – External kernel module providing battery charge thresholds, recalibration and specific tlp-stat -b output for older ThinkPads
Install them either with your favorite package manager or the command:"
sudo apt-get install tlp tlp-rdw# ThinkPads require an additional:sudo apt install acpi-call-dkms tp-smapi-dkms# on (much) older kernels like 3.4 you'll also need this:sudo vi /etc/pm/sleep.d/thinkpad_acpiSUSPEND_MODULES="thinkpad_acpi"
I am including the TLP config file for my daily driver below. With average workloads this one gets me several hours of extra battery life. As you can see this config throttles back the CPU quite aggressively when running on battery.
Note, this machine has two batteries, which is reflected in the config.
2) Making your ThinkPad run faster:
While most people think of raising the core voltage for over-clocking and big elaborate cooling systems when trying to increase the speed of their CPU, Intel laptop CPUs actually offer another approach. Provided you have a CPU generation later than Haswell you should be able to apply a fixed voltage offset to the different voltage planes and thereby undervolt the CPU.
The undervolt tool by georgewhewell is one of the most convenient ways of achieving this under Linux. His github repo below provides excellent instructions on how to install and configure the undervolt tool, so I won't repeat them here and just provide the link:
While this might seem at first counter intuitive for achieving performance gains, this works based on the fact that most dies sold to OEMs are of a sufficiently high quality that they will still run stably with their core voltage dropped between 75 and 100 mV. The offset you can achieve depends on your individual CPU. Some samples are can tolerate a little more others less.
Undervolting the CPU's voltage planes results in less heat under load, which in turn avoids the automatic thermal throttle kicking in when running with automatically boosted clock speeds under Intel turbo boost. Most laptop CPUs are only able to sustain turbo boost frequencies for a minute or two before their cooling systems get overwhelmed and they throttle back. A high quality CPU sample undervolted in the same machine can sustain turbo boot for hours at a time. Thus your machine essentially runs natively overclocked while producing less heat under normal operation, leading to quieter fans.
Once you have mastered the instructions form the readme of the undervolt repo, you need to find the right settings that work for your specific machine.
So you need to test your machine under full load until it crashes, then reduce the offset by e.g. 5 mV and test again until you achieve a stable system that will run without crashing. Ideally you should let it run under load for an hour or more.
To test stability, try system stability tester. Get the latest generic built from: http://systester.sourceforge.net
Yes, this 8 year old code but still does the job just fine.
tar zxvf systester-1.5.0-linux-amd64.tar.gzcd systester-1.5.0-linux-amd64sudo cp systester /usr/local/bin
Make executable if needed.
To run the application, you can simply run this command: