Log power button

Polytropon freebsd at edvax.de
Wed Jan 27 19:04:31 UTC 2016

On Wed, 27 Jan 2016 19:55:22 +0100, Andrea Venturoli wrote:
> Hello.
> A server of mine (10.1) is "spontaneusly" rebooting.
> This is not a power failure/panic/crash/whatever, since it properly 
> shuts down.
> I suspect someone is pushing the power button, but I have no physical 
> way to check. Problem is, this is not reported in the logs.

There are two things that the power button can do:

(a) short press: The OS will take the required action (shut down);

(b) long press: The computer will be forced to power off (no OS shutdown,
    no OS action) - equivalent to ripping out the power cord.

You can work with (a), and it will cause a log message. Case (b)
won't log anything as the system is _forced_ off.

> I vaguely remember older FreeBSD versions did this once, but I might be 
> wrong; I cannot check on this box (100km away), but I tried on another 
> one and, to my surprise, the fact that I pressed the power button was 
> NOT logged.

Older FreeBSD versions that utilized APM could have a custom action
when pressing the power button as in case (a) mentioned above. The
corresponding file was /etc/apmd.conf. Today ACPI is being used for
controlling what happens when the button is pressed.

> Is there any way to enable this?

I'm not sure APM can be re-enabled, it's probably not present "in
hardware" anymore...

> Maybe I'm dumb, but I looked for this and found nothing.

No, it just doesn't really exist anymore, no matter how hard you look. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list