I installed Debian Jessie on my laptop. To send the laptop to sleep (suspend), I began to try to edit the files in /etc/acpi (including the subdirectory /events ), using numerous tips from Google. Finally, he came to the following behavior: when you press the power key, the laptop goes to sleep, but if you press it again, the laptop turns on and ... immediately turns off.

Going to sleep was able to set the file /etc/acpi/powerbtn.sh with the following content:

 #!/bin/bash /usr/sbin/pm-suspend 

Question: how to make the laptop go to sleep by pressing the power button and go out without turning it off (as it is now)?


UPD_0 (deleted the second block with files due to loss of relevance):

I created for the powerbtn.sh , powerbtn-acpi-support.sh , events/powerbtn and events/powerbtn-acpi-support files that I started the file and found out the following: the files in the /etc/acpi/ folder are not used, but only files from /etc/acpi/events/ .

events/powerbtn :

 event=button[ /]power action=sh /etc/acpi/events/powerbtn-log.sh 

events/powerbtn-log.sh :

 #!/bin/bash echo "events/powerbtn" >> /home/rostislav/log.txt /usr/sbin/pm-suspend 

File events/powerbtn-acpi-support :

 event=button[ /]power action=sh /etc/acpi/events/powerbtn-acpi-support-log.sh 

events/powerbtn-acpi-support-log.sh :

 #!/bin/bash echo "events/powerbtn-acpi-support" >> /home/rostislav/log.txt /usr/sbin/pm-suspend 

Log output:

 events/powerbtn-acpi-support events/powerbtn 

And the problem arises: why after running powerbtn-acpi-support computer does not restart?


UPD_1 : another paradox. If you delete any file from events/powerbtn-acpi-support or events/powerbtn - the reboot stops working!

  • I do not understand all these events, and I do not know what is there and how it should work. but if the changes you made led to changes in the behavior of the system, then, with a high degree of probability, it was your changes that caused this. - aleksandr barakin
  • @alexanderbarakin, before my system, at least, did not go into sleep. It remains to understand the reason for shutting down ... - Rostislav Dugin
  • Sorry, I do not catch your thought in the second sentence: "To send the laptop to sleep, I began to try the files." - Beast Winterwolf
  • @BeastWinterwolf, accidentally deleted part of the sentence. Corrected. - Rostislav Dugin
  • Without a laptop model and a kernel version, it’s hard to advise anything, maybe a bug in the software, and maybe in your scripts. - 0andriy

1 answer 1

The laptop turns off because two daemons are watching the button. One is the acpid that you have configured, and the second is systemd.

The following happens: When you press the button, systemd starts shutting down, and acpid at this point takes the computer to sleep. When you wake up, shutdown resumes.

Systemd is configured here /etc/systemd/logind.conf

 # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See logind.conf(5) for details. [Login] #NAutoVTs=6 #ReserveVT=6 #KillUserProcesses=no #KillOnlyUsers= #KillExcludeUsers=root #InhibitDelayMaxSec=5 #HandlePowerKey=poweroff HandleSuspendKey=hibernate HandleHibernateKey=hibernate HandleLidSwitch=hibernate #HandleLidSwitch=hybrid-sleep #HandleLidSwitchDocked=ignore #PowerKeyIgnoreInhibited=no #SuspendKeyIgnoreInhibited=no #HibernateKeyIgnoreInhibited=no #LidSwitchIgnoreInhibited=yes #HoldoffTimeoutSec=30s #IdleAction=ignore #IdleActionSec=30min #RuntimeDirectorySize=10% #RemoveIPC=yes #InhibitorsMax=8192 #SessionsMax=8192 #UserTasksMax=33% 

As you can see, I set up hibernation to close the lid. Here you can disable button processing. Or remove your scripts and set up here.

In Gnome, using gnome-tweak-tool (or gnome-control-center in later versions), you can override actions at the touch of a button. After logging in, the Dwarf will reconfigure systemd to the specified behavior.