Knowledge base
  • Goal of knowledge base
  • Linux & core
    • Linux
      • Record SSH session for reporting
      • Compress / Decompress files
      • Colorize logs
      • Cron output & logging
      • Signal
      • Break out and escape SSH session
      • Mount volume permanently
      • Show processes most consuming CPU & MEM
      • Improve and optimize battery life on Linux
      • File ownership & groups in linux
      • Automatic security update/patch on Ubuntu
      • Clean buffers and cached on linux
      • Bash completion on Linux/Mac
    • Core services
      • Nginx reload
      • OpenVPN Split tunneling
      • Nmap commands
    • Hardware
      • CPU Architecture fundamental
  • Database
    • MySQL
      • InnoDB - innodb_file_per_table parameter
      • MySQL - enable slow query log
      • MySQL - export large tables
    • MongoDB
  • Container
    • Docker
      • ADD or COPY in Dockerfile
        • Clean data of docker completely
    • Podman
  • Automation
    • Ansible
      • Output format
  • Build & Deployment
    • Jenkins
      • Jenkins - force exit pipeline when failure
  • Language & Toolset
    • PHP
      • Composer
      • php-redis & php-igbinary
  • Mindset
    • Technical based
      • Writing well
      • Reinvent The Wheel
      • Approach a new system
      • Backup philosophy
      • Mindset for building HA and scalable system
      • GitLab database incident
    • Non-technical based
      • How to read news efficiency?
      • How long should you nap?
      • Assume good faith
  • Reference & learning source
    • Books
      • Sysadmin/SRE
      • Mindsets
      • Software fundamentals
    • English
Powered by GitBook
On this page
  • Goal
  • Solution
  • Installation
  • Reference
  1. Linux & core
  2. Linux

Improve and optimize battery life on Linux

Goal

Maximum battery life on linux within reasonable and acceptable daily workloads

Case study: Thinkpad x240 with 9cells battery on ubuntu 16.04

  • Before: from 100% to 5% - ~ 3.5hours

  • After installing TLP: ~ 5hours

Solution

TLP brings you the benefits of advanced power management for Linux without the need to understand every technical detail. TLP comes with a default configuration already optimized for battery life, so you may just install and forget it. Nevertheless, TLP is highly customizable to fulfill your specific requirements.

Please note: TLP runs on every laptop brand. Setting the battery charge thresholds is available for IBM/Lenovo ThinkPads only.

Installation

# Add PPA
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update

# Especially for thinkpad
sudo apt-get install tp-smapi-dkms acpi-call-dkms

# Install
sudo apt-get install tlp tlp-rdw

Start: TLP will start automatically. To avoid having to restart the system, the first time you can start it manually by using the following command:

sudo tlp start

Check: Use the tlp-stat terminal command to check if TLP is working properly

▶ sudo tlp-stat -s
[sudo] password for devops: 
--- TLP 1.0 --------------------------------------------

+++ System Info
System         = LENOVO ThinkPad X240 20AMS1WY00
BIOS           = GIET75WW (2.25 )
Release        = Ubuntu 16.04.2 LTS
Kernel         = 4.10.0-27-generic #30~16.04.2-Ubuntu SMP Thu Jun 29 16:07:46 UTC 2017 x86_64
/proc/cmdline  = BOOT_IMAGE=/boot/vmlinuz-4.10.0-27-generic.efi.signed root=UUID=34cadb32-d632-4d98-a4a8-a1c53753dc35 ro quiet splash vt.handoff=7
Init system    = systemd v229
Boot mode      = UEFI

+++ TLP Status
State          = enabled
Last run       = 10:41:53 PM,   3685 sec(s) ago
Mode           = battery
Power source   = battery

Reference

PreviousShow processes most consuming CPU & MEMNextFile ownership & groups in linux

Last updated 6 years ago

http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html