Which setup, tools and customization can optimise elementary OS towards achieving maximal battery life time on laptops?
5 Answers
The simplest way is installing tlp( tlp's default settings are a good balance between performance and power save)
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
Install thermald (like Saeed suggested)
sudo apt-get install thermald
Leaving Bluetooth turned off also saves you battery. (TLP allows you to configure this in
/etc/default/tlp
)For Intel: It may also be beneficial to use intel integrated graphics instead of your discrete graphics card if you have one.
For Intel i3,5,7:
sudo apt-get install intel-microcode
For AMD:
sudo apt-get install amd64-microcode
I've noticed better battery life (may be placebo, didn't take stats) after installing microcode packages.
- Monitoring and Tunables (powertop)
sudo apt-get install powertop
Use sudo powertop
to run, probably the best way to identify the big drainers and check power usage statistics but what most interests us is its tunables section, which shows you if tweaks have been applied to optimize power usage and allows you to apply said tweaks.
If you have a Thinkpad laptop you'll also have to install these utilities for TLP
sudo apt-get install tp-smapi-dkms acpi-call-dkms
-
-
1You don't need to actually type
tlp-drw
. It's installed automatically when you choose to installtlp
.– r3blAug 5, 2015 at 12:47 -
Yes, it's automatically pulled but since its official instructions tell to install it manually I decided not to change it Aug 5, 2015 at 13:03
-
Fair enough. Maybe you should include
powertop
to your answer as well? ItsTunables
tab offers some additional power tweaks and provides a pretty easy way to fix them.– r3blAug 5, 2015 at 16:36 -
Good idea, I know tlp in battery mode applies almost all of powertops tunables, but it is still worth a mention Aug 5, 2015 at 16:39
- If you have a Hybrid graphics laptop you should install bumblebee. Here is an installation guide on Freya.
- Installing thermald :
The demand for high performance desktop/laptop systems has resulted in higher power dissipation. This problem is compounded by increased demand for small form factor systems. It is increasingly difficult to manage performance and thermal issues in isolation. Thermal issues are important to handle proactively without significantly impacting performance.
The solution used in this document is to develop a thermal daemon, which proactively controls thermal, using P-states, T-states, and the Intel power clamp driver.
Actually it monitors and controls the CPU temperature, resulting in reduced overheating. You can install it on elementary:
sudo apt-get install thermald
Install TLP as John Guerreiro mentioned. But note that if you are using ThinkPad you require one additional step
sudo apt-get install tp-smapi-dkms acpi-call-dkms
Here is a full guide for installation.
-
Isn't Bumblebee meant only for systems with NVIDIA Optimus technology? What about laptops with AMD Radeon graphics? Mar 9, 2016 at 7:56
-
Yes it's for nvidia, you can use the official
fglrx
driver which has some support for hybrid graphic cards Mar 9, 2016 at 8:06 -
I have tried using AMD proprietary drivers, but I had strange issues with them. Screen flickered all the time after I enabled them in "Restricted Drivers". Mar 9, 2016 at 8:08
-
Some laptops allow to switch between graphic chipsets from bios setting, did you check that? Mar 9, 2016 at 8:11
-
1Bumblebee team will add amd support in future (github.com/Bumblebee-Project/Bumblebee/issues/52) but take a loot at this project github.com/YoRyan/bumblebee-amd-hacks hope it works for you Mar 9, 2016 at 8:19
Copy and paste the solution (at least for me):
sudo add-apt-repository ppa: linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw indicator-cpufreq
Now, edit grub. Execute the following command to open a text editor so you can edit the file:
sudo scratch /etc/default/grub
Using your arrow keys, scroll down to line 11 where it should say this or something similar:
GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash"
Change the line to say this instead:
GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash intel_pstate=disable"
Save the changes and then run the following command to update Grub:
sudo update-grub
Reboot the system and if indicator-cpufreq does not show up in the panel automatically, press Alt + F2, type indicator-cpufreq and then press Enter.
Also, you need to edit the TLP configuration file before you use it. Execute the following command to edit the file:
sudo scratch /etc/default/tlp
If you'd rather use gedit instead of scratch, you can use either one of these commands instead: gksu gedit/etc/default/tlp or sudo gedit/etc/default/tlp.
Scroll down to where you see these two lines:
# CPU_SCALING_GOVERNOR_ON_AC = powersave
# CPU_SCALING_GOVERNOR_ON_BAT = powersave
Edit those lines by removing the comment (pound symbol) from the beginning or each line and change "powersave" to "ondemand" like you see here:
CPU_SCALING_GOVERNOR_ON_AC = ondemand
CPU_SCALING_GOVERNOR_ON_BAT = ondemand
Another line you probably want to change is this one:
DISK_APM_LEVEL_ON_BAT = "128 128"
Change 128 128 to 254 254:
DISK_APM_LEVEL_ON_BAT = "254 254"
Scroll down to:
WIFI_PWR_ON_BAT = 0
And change that to:
WIFI_PWR_ON_BAT = 1
Save the file before you exit and restart TLP for the changes to take effect.
If you ever want to scale the frequency down, click on the indicator-cpufreq icon on the top panel and choose "ondemand", "powersave", or whatever to allow the CPU to wind down for better efficiency.
Each system is different and I have the basics in mine, some background processes can have a big impact on your batteries. For now I still testing mine. Greetings.
-
2would you be able to add some explanation as to what these options mean and what it means to change them? thannks Jan 8, 2018 at 12:29
Make sure your descrete graphics are turned off I disabled it via an ACPI call. First check which VGA devices are in use:
lspci | grep VGA
This will show all the GPU's. Notice the state (rev xx, mine is rev a2 for the nVidia one).
The following commands worked for me:
sudo apt install acpi-call
sudo modprobe acpi_call
This method requires you to have the Linux headers already installed for your kernel, which was the case for me. Then run the following sh script:
#!/bin/bash
if lsmod | grep -q acpi_call; then
methods="
\_SB.PCI0.P0P1.VGA._OFF
\_SB.PCI0.P0P2.VGA._OFF
\_SB_.PCI0.OVGA.ATPX
\_SB_.PCI0.OVGA.XTPX
\_SB.PCI0.P0P3.PEGP._OFF
\_SB.PCI0.P0P2.PEGP._OFF
\_SB.PCI0.P0P1.PEGP._OFF
\_SB.PCI0.MXR0.MXM0._OFF
\_SB.PCI0.PEG1.GFX0._OFF
\_SB.PCI0.PEG0.GFX0.DOFF
\_SB.PCI0.PEG1.GFX0.DOFF
\_SB.PCI0.PEG0.PEGP._OFF
\_SB.PCI0.XVR0.Z01I.DGOF
\_SB.PCI0.PEGR.GFX0._OFF
\_SB.PCI0.PEG.VID._OFF
\_SB.PCI0.PEG0.VID._OFF
\_SB.PCI0.P0P2.DGPU._OFF
\_SB.PCI0.P0P4.DGPU.DOFF
\_SB.PCI0.IXVE.IGPU.DGOF
\_SB.PCI0.RP00.VGA._PS3
\_SB.PCI0.RP00.VGA.P3MO
\_SB.PCI0.GFX0.DSM._T_0
\_SB.PCI0.LPC.EC.PUBS._OFF
\_SB.PCI0.P0P2.NVID._OFF
\_SB.PCI0.P0P2.VGA.PX02
\_SB_.PCI0.PEGP.DGFX._OFF
\_SB_.PCI0.VGA.PX02
\_SB.PCI0.PEG0.PEGP.SGOF
\_SB.PCI0.AGP.VGA.PX02
"
for m in $methods; do
echo -n "Trying $m: "
echo $m > /proc/acpi/call
result=$(cat /proc/acpi/call)
case "$result" in
Error*)
echo "failed"
;;
*)
echo "works!"
# break # try out outher methods too
;;
esac
done
else
echo "The acpi_call module is not loaded, try running 'modprobe acpi_call' or 'insmod acpi_call.ko' as root"
exit 1
fi
If you are lucky, one of of the lines will end at 'works!'.
Running lspci | grep VGA
again and look at the rev. It should now say rev ff. This means your card is disconnected.
This needs to be done every system boot. So you may want to add the following line to /etc/rc.local which will automate this vor you:
modprobe acpi-call
and then place the script above. You may remove all others except the one that worked for you.