hieuhtr / Blog

Don’t be lazy. Don’t make excuses. No one cares. Work fucking harder.
Other
6 stars 2 forks source link

Improve and optimize battery life on Linux #58

Open hieuhtr opened 7 years ago

hieuhtr commented 7 years ago

Goal

Maximum battery life on linux within reasonable and acceptable daily workloads

Case study: x240 9cells battery - ubuntu 16.04

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

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