Configure Linux to Suspend to Disk on Acpi G2 Soft Off - So Google Compute Engine Can Suspend and Restore Preemptible Machine via Disk

resume/suspend enery star linux from command line

A machine that is hibernating cannot come out of sleep without pressing the power button, or sending a magic packet if the ethernet adaptor has Wake On Lan (WOL) capability and the motherboard supports that. WOL packets can only be generated on the local network, not remotely from other networks.

-Adam

How can I automatically hibernate and reawaken my Ubuntu server?

This question has an answer here: https://askubuntu.com/questions/61708/automatically-sleep-and-wake-up-at-specific-times

Basically, the solution is to use rtcwake with the --mode option. Here is the description from man rtcwake:

-m mode | --mode mode
Use standby state mode. Valid values are:

standby ACPI state S1. This state offers minimal, though real, power savings,
while providing a very low-latency transition back to a working
system. This is the default mode.

mem ACPI state S3 (Suspend-to-RAM). This state offers significant power
savings as everything in the system is put into a low-power state,
except for memory, which is placed in self-refresh mode to retain
its contents.

disk ACPI state S4 (Suspend-to-disk). This state offers the greatest power
savings, and can be used even in the absence of low-level platform
support for power management. This state operates similarly to
Suspend-to-RAM, but includes a final step of writing memory contents
to disk.

off ACPI state S5 (Poweroff). This is done by calling '/sbin/shutdown'.
Not officially supported by ACPI, but usually working.

How to know if system has just woken up from a mem sleep?

Linux device drivers for PCI devices can optionally handle suspend and resume which, presumably, the kernel calls, respectively, just before the system is suspended, and just after resuming from a suspend. The PCI entrypoints are in struct pci_driver.

You could write and install a trivial device driver which does nothing more than sense resume operations and provides an indication to any interested processes. The simplest might be to support a file read() which returns a single byte whenever a resume is sensed. The program only need open the device and leave a thread stuck reading a single character. Whenever the read succeeds, the system just resumed.


More to the point, if the devices your application is handling have device drivers, the drivers should be updated to react appropriately to a resume.

Linux Power management API

DBus provides some basic power management functionality within the org.freedesktop.PowerManagement bus.



Related Topics



Leave a reply



Submit