-1

I want to be able to power off my server using the power button on the front of the case, rather than having to login and power it off manually.

From my research thus far I believe I have to install acpi to do this, which I have done.

I have started the acpi service, and enabled it with systemctl. The status is now "active".

However when I press the button, I have no idea if the system is powered off, or sleeping.

I suspect it is sleeping and not powered off, because it boots quite quickly again if I press it again.

How can I test if acpi is working? I tried to look in the system log file /var/log/syslog, but there's a lot in there and I don't know exactly what to look for.

1
  • Does last -x help?
    – Quasímodo
    May 25, 2020 at 18:36

1 Answer 1

1

You can configure the behavior of the power button by editing /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=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

Simply uncomment the line #HandlePowerKey=poweroff and reboot (although the default in Debian 10 seems to already be power off when pressing the power button).

1
  • Perfect, thanks! May 27, 2020 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .