Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I boot with a resume=.. option to the kernel and an initrd built with a -h option, userland tools (say, batti) offer me the choice of hibernation; when I boot without them it does not.

Where is the fact that I have a system capable of hibernate/resume exposed for these tools to find that out? (This is on Slackware, in case this is init-specific.)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

One way to do this is via the /sys/power interface. The usual way to induce hibernation (used by various higher level tools) is to write to a couple of the fields there:

echo shutdown > /sys/power/disk
echo disk > /sys/power/state

I believe the first one sets the methodology and the second one triggers the change.1 However, if you read from these nodes, you get a list of possibities:

> cat /sys/power/disk
platform [shutdown] reboot suspend

> cat /sys/power/state
freeze standby mem disk

Since shutdown and disk are available, the machine can be put into hibernation.


1 You can also set platform on /sys/power/disk to do the same thing via the system's ACPI hardware, presuming the driver works properly, and echo mem > /sys/power/state puts the machine into suspend (state saved to ram).

share|improve this answer
    
Cool, thanks. I've written to those files for years and never thought to read from them. –  Bandrami Jun 8 at 13:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.