PowerManager

From campisano.org
Jump to navigation Jump to search

Debian Stretch

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

Power button management

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