OpenBSD Journal

Delayed hibernation comes to OpenBSD/amd64 laptops

Contributed by Peter N. M. Hansteen on from the sweet dreams are made of cheese dept.

In a move that would have gone unnoticed by most but will be appreciated by OpenBSD/amd64 laptop users, Mark Kettenis (kettenis@) committed support for delayed hibernation with the new machdep.hibernatedelay sysctl

The commit message reads,

List:       openbsd-cvs
Subject:    CVS: cvs.openbsd.org: src
From:       Mark Kettenis <<ettenis () cvs ! openbsd ! org>
Date:       2026-03-11 16:18:42

CVSROOT:	/cvs
Module name:	src
Changes by:	kettenis@cvs.openbsd.org	2026/03/11 10:18:42
Modified files:
	sys/arch/amd64/amd64: acpi_machdep.c machdep.c 
	sys/arch/amd64/include: cpu.h 
	sys/arch/amd64/isa: clock.c 
	sys/dev/acpi   : acpi.c acpi_x86.c acpivar.h 
	sys/kern       : subr_suspend.c 
	sys/sys        : device.h 

Log message:
Implement delayed hibernation.  If the machdep.hibernatedelay sysctl is
set to a value that isn't zero, this specifies a number of seconds after
which the machine will wake up from suspend and hibernate itself.

ok florian@, mlarkin@

yes, another lifesaver and battery saver!

This should be in -current snapshots about the time you read this, and is likely to be included in the upcoming release.


Comments
  1. By John McCue (jmcunx) jmcq66@comcast.net on

    I never heard of any OS doing this, but I want to understand what it does.

    So, if I sleep my system and achdep.hibernatedelay is set to 10, when I sleep 10 seconds later it will automatically un-sleep ?

    Thanks

    Comments
    1. By Christian Ruesch (crsc) on

      As I understand it, you set this to one hour, for example, with machdep.hibernatedelay=3600, and when you close your laptop, it suspends normally and, to save battery power, goes into hibernation after one hour.

      If you open your laptop again before the hour is up, the system will wake up from suspend mode. If you open your laptop after the hour is up, it will wake up from hibernation mode.

    2. By Solène Rapenne (solene) solene+undeadly@perso.pw on https://dataswamp.org/~solene/

      This is a feature available in Windows, Mac OS and Linux.

      The goal is to find the right spot between the suspend mode that allows a quick resume but will draw a lot of battery over a day, versus hibernation which uses no battery (only a little extra to save and restore the memory from/to disk) and can sleep forever and still resuming your previous session.

      This is useful for the cases where you put your system in suspend moe and forgot about it and want to use it two days later and battery is dead, which led to a faulty shut down and potential data loss.

      Comments
      1. By John McCue (jmcunx) jmcq66@comcast.net on

        Very nice, I can see me using this.

        Thanks!

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]