How to extend your laptop battery lifespan on Linux Ubuntu/Debian

As computers become more powerful and more efficient, they rapidly drain their batteries because they consume more electricity. While this might depend on the number of running applications, laptop moans are mainly caused by battery life especially when they are not plugged in throughout the day.

It is still possible however to get some improvements by some software tweaks and good practice. Notwithstanding the use of a lightweight desktop environment, laptop users running on Ubuntu have the possibility to extend the life of their batteries by using a power management utility called TLP.

In this article, we will provide a description of TLP and explain how to enable it on your Ubuntu laptop . We also provide some useful tips to help optimize power consumption. 

Read: How to open System Settings from the terminal in Ubuntu 18.04?

What is TLP ?

TLP is a free, feature-rich open source utility for battery use improvement on laptops running Linux distros such as Ubuntu.

Without having to delve deeper into technical details, the TLP tool can exploit advanced Linux power management to bring users its many benefits. Indeed, when your laptop is unplugged, i.e. running on its battery, the TLP operates by optimizing the hardware devices power usage. Here are some features of TLP :

  • Many customization options and several power saving parameters
  • Provides USB autosuspend with blacklist
  • Uses dirty buffer timeouts and kernel laptop mode
  • Power management for PCI Express active state (PCIe ASPM)
  • Multi-core/hyper-threading process scheduler power awareness
  • Supports processor “turbo boost” and “turbo core”
  • PCI(e) bus devices runtime power management
  • Wifi and audio power saving mode support
  • Hard disk advanced power handling and spin down (non SSD) timeout (per disk)
  • Radeon graphics power management support (KMS and DPM)
  • SATA aggressive link power management (ALPM) support
  • Includes an I/O scheduler (per disk)

The default settings that come with TLP are already optimized and perfectly tuned for better battery management so that you do not have to tweak anything. The configuration file can be found at /etc/default/tlp. This is said, TLP offers users different customization options in order to fulfill their specific needs. TLP is available in GUI and CLI (Command Line Interface or terminal) so that beginner and advanced users alike can use it as they see fit. All that is needed is to get TLP installed and that’s it !

Read: How to display Graphics card information on Ubuntu 22.04

Installation of TLP

Open up your terminal or command line either by pressing on Ctrl+Alt+T or through the Application Launcher.

You would first need to have an up-to-date repository index by running the command below :

sudo apt-get update

The package lists will be downloaded from the remote repositories and will be updated with information on the latest versions of packages along with their dependencies. Make sure to use sudo or a user with the required privileges.

In order to install TLP , invoke the command below:

sudo apt-get install tlp                          [ubuntu tlp]

You will be prompted with a Y/N question to continue the installation. Go ahead and enter Y in order to proceed with the installation. Depending on your Internet connection speed, this might take several seconds. Once completed, TLP will be added to the list of installed applications.

Read: How to save power on Linux Ubuntu/Debian using cpufreq

TLP will be running as a service after system start. You could check if it is up and running by using the command below :

sudo systemctl status tlp

Using TLP with the command line

Starting TLP

Now that TLP is ready to be used, let’s start it in the terminal by running the following command :

sudo tlp start

TLP status

In order to see the status of the TLP utility as well as detailed system information execute the command below:

sudo tlp-stat -s

Linux battery life status check

TLP default configuration

As mentioned above, TLP operates initially using a default configuration that is perfectly tuned to fit the needs of your operating system and hardware. You can display the default configuration of TLP using the following command:

sudo tlp-stat -c

Battery report display

TLP allows you to view a detailed report about your current laptop battery. This can is achieved by using the -b switch as shown below :

sudo tlp-stat -b

Ubuntu battery drain check

 Temperature display

To display the temperature of the CPU, issue the command below :

sudo tlp-stat -t

Ubuntu laptop / PC CPU check

Uninstalling TLP

In order to remove TLP from your system, you could use the command below for instance :

sudo apt-get remove tlp

Using TLP with the GUI

Installation of the required PPA

Besides CLI, TLP utility offers a graphical interface that can be installed from Linux Uprising PPA. This is because TLP is not available at the Official Ubuntu repositories as highlighted in the snapshot below.

You would first need to add the PPA which will be used to install the TLP graphical user interface application. Open your terminal ad issue the command below :

sudo add-apt-repository ppa:linuxuprising/apps

Allow few seconds for this to run.

Installation of TLP UI

As was done before in the case of CLI, you would need to run the command below beforehand in order to to have an up-to-date repository index:

sudo apt-get update

Now to install the TLP UI, run the command :

sudo apt-get install tlpui

You will be prompted with a Y/N question to continue the installation. Go ahead and enter Y in order to proceed with the installation. Depending on your Internet connection speed, this might take several seconds. Once completed, TLP UI will be added to the list of installed applications.

Using TLP UI

TPL UI is now ready to be used. You can launch it by searching for ‘tlp’ in the Application Launcher as follows:

This can also be done by running the command below in the Terminal :

tlpui

This will launch the TLP UI application as shown in the snapshot below :

You could edit the TLP settings on the configuration tab above.

The statistics tab will enable you to view your battery and system statistics.

Using the checkbox TLP_ENABLE below :

You will have the possibility to enable or disable battery optimization feature through TLP, based on your settings.

Uninstalling TLP UI

To remove the TLP UI utility from your system , run the command below :

sudo apt-get remove tlpui

To also remove the added PPA, use the command below :

sudo rm /etc/apt/sources.list.d/linuxuprising-ubuntu-apps-bionic.list

Final word on TLP

You have seen two methods which allow you to install and use TLP. TLP utility will allow you to efficiently use your laptop battery on your Ubuntu system. You will hopefully start to notice some improvements on the way your battery is used after you run the TLP service. To know more about TLP, you can visit its website here.

Useful tips to improve your battery life

In this section, you will find some short tips on how to ameliorate your average laptop battery lifespan and how to optimize its usage.

Unplug or turn off peripheral devices

Since your laptop motherboard has to power all your USB connected devices such as webcams, USB keys, mouse , you would just need to eject them to save some juice unless this is absolutely necessary.

The webcam can be turned off using a function button. Your speakers should also be muted if you do not need sound, since every time your laptop beeps this can be a drain.

Laptop backlight

A Laptop screen can drain more power than some other devices of the laptop. This power-hungry screen can consume large amounts of your battery power in order for you to enjoy clear and bright looking display.

There is a nonlinear dependency between power consumed and brightness level. This means that increasing the brightness level in the lowest settings consumes less power than when stepping this up in the highest settings.

You can simply turn the brightness down and avoid the full level in order to save some power. Measurements on a typical laptop show that dropping to 2/3 brightness will save you about 1 Watt.

Reduce Wakeup Events

Wakeup events triggered by some applications can arouse an idle processor which leads to power consumption. There some applications which cause such wakeups, for instance flash in web pages, in which case you can choose to not install flash or simply close your browser tab when you don’t need it anymore. There are some tools that can help identify similar situations, like Intel’s PowerTop which is featured further down in this article.

Use a lightweight desktop environment

Ubuntu offers a lightweight desktop environment called Lubuntu that does not require extensive computer power (graphics). To install Lubuntu, execute the command below :

sudo apt-get install lubuntu-desktop

Once finished, you could load Lubuntu desktop environment directly from the login screen.

Some common applications have lightweight alternatives. For example, you might want to use Gdebi (package installer) or AppGrid rather thenUbuntu Software Center or AbiWord instead of LibreOffice Writer .

Wi-Fi disabling

The laptop built-in wireless networking capabilities are amongst the parts that sap the battery life the most. The battery is constantly being drained by Wi-Fi since power is continuously drawn by the wireless device, even when it is not connected since it is looking for available wireless networks nearby.

When there are no wireless networks available, you can simply turn off this device. On Ubuntu you can do this manually by switching to airplane mode as follows :

  • Open up the Activities application and type in Wi-Fi
  • Click on Wi-Fi tab to open the corresponding panel
  • Switch on Airplane Mode. You wireless connection will be turned off until airplane mode is enabled again.

It is also possible turn off your Wi-Fi connection directly from the system menu:

  • Simply click on the connection name and choose Turn Off

If you are at ease with the command line, you could issue the commands below to disable your WiFi :

  • nmcli radio wifi off

To re-enable it, use the command :

  • nmcli radio wifi on

For more on this, refer to the documentation as per the commands below :

  • nmcli radio help
  • nmcli radio wifi help

Fix high memory usage

You might be using few applications on the frontend, but on the background, unknown to you, there could be many services running in the backend. These background processes are actually draining away your battery for instance, workspace, Compiz or dock .

The best remedy here is to stop unnecessary services from running at boot. We have written a detailed article on how to achieve this along with other methods which might help lower memory usage and thereby save some power.

Conclusion

You have seen some tools as well as some tips that might help extend the life of your laptop battery. TLP utility will enable you to use your laptop battery on your Ubuntu system in an efficient way. Good practice tips might also come in handy, like for instance dimming your laptop screen or unplugging connected USB devices. 


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

ziad nahdy

Ziad Nahdy, fan of open source and programming languages. He is a technical writer, blogger and Linux enthusiast. He loves to read and help others with their problems. He is addicted to open source software but he also loves other technology related subjects.

This Post Has 2 Comments

  1. Fedele

    The first line in your article reads, “As computers become more powerful and more efficient, they rapidly drain their batteries because they consume more electricity.” More efficient means consuming less electricity. The rest of the article is fine.

    The best way to extend your battery lifespan is taking it out of the laptop when it is plugged in for long periods of time. Use the battery only when traveling, otherwise store it at 50% charge.

  2. JohnIL

    I’ve dealt with reduced battery life in Linux desktops forever, and it never really improves that much. Sure, you can waste time trying all these tricks but they end up just being performance compromises to slightly improve battery consumption. So I have to darken my screen more on Linux vs Windows, or throttle my CPU more vs Windows to improve my battery life?? How about working on the kernel and drivers to better deal with consumption since so many use notebooks these days? Linux is fine running on a desktop PC, but to run it on a notebook means staying close to a power source which is frustrating.

Leave a Reply