PowerManager

From campisano.org
Jump to navigation Jump to search

Reduce power consumption

What TLP basically does is tweaking kernel settings that affect power consumption.
  • Install:
apt-get install tlp
  • Configure:
cat > /etc/tlp.d/00-optimizing.conf << EOF
# Extend battery runtime
# from https://linrunner.de/tlp/support/optimizing.html#extend-battery-runtime

CPU_ENERGY_PERF_POLICY_ON_AC=balance_performance
CPU_ENERGY_PERF_POLICY_ON_BAT=power

PLATFORM_PROFILE_ON_AC=balanced
PLATFORM_PROFILE_ON_BAT=low-power

CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0

CPU_HWP_DYN_BOOST_ON_AC=1
CPU_HWP_DYN_BOOST_ON_BAT=0
EOF
chmod 644 /etc/tlp.d/00-optimizing.conf
  • Start (and enable at boot)
systemctl start tlp
systemctl enable tlp

Power button management

Debian Stretch

Debian Jessie
...
With systemd, pm-utils and its hooks are not used any more, instead there's systemd-suspend.

Part of the official Debian documentation is outdated, still using acpi config folder:

We can cosider the follows

And edit the config file /etc/systemd/logind.conf to handle the behavior that we want

For instance, to put the PC to sleep on power button press, change the value of HandlePowerKey property unde the [Login] section from the default

#HandlePowerKey=poweroff

to

HandlePowerKey=suspend
  • Restart the service
systemctl restart systemd-logind.service
  • Note: pm-util is not necessary anymore and apparently can be removed:
apt-get remove --purge pm-utils

There are other packages installed but not needed to manage events with systemd, so the follow maybe can removed too (still testing that):

apt-get remove --purge upower libupower-glib3 powertop powermgmt-base

  • Note: in a Dell notebook Latitude 7480 there is something that cause an eternal sleep request loop, and lid close cause shutdown:

For sleep loop issue, I made the follow changes to grub bootstrap options (and applied with 'update-grub' command):

diff --git a/default/grub b/default/grub
-GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX_DEFAULT="pci=noaer"

For lid close shutdown issue, I made the follow changes to systemd logind configuration (and applied restarting the machine, restarting just the service does not work):

diff --git a/systemd/logind.conf b/systemd/logind.conf
-#HandlePowerKey=poweroff
-#HandleSuspendKey=suspend
-#HandleHibernateKey=hibernate
-#HandleLidSwitch=suspend
-#HandleLidSwitchDocked=ignore
+HandlePowerKey=suspend
+HandleSuspendKey=suspend
+HandleHibernateKey=suspend
+HandleLidSwitch=ignore
+HandleLidSwitchDocked=ignore

Before Debian Stretch

(or before jessie, whenever /etc/acpi folder was used)

  • Edit file 'acpi/powerbtn-acpi-support.sh'
  • replace the 'shutdown' command with the 'pm-suspend' one

for example:

###     /sbin/shutdown -h -P now "Power button pressed"
        pm-suspend