This is an old revision of the document!


Suspending to RAM or disk

Suspending or hibernating a system is essentially handled by the kernel; some care must be taken, however, with respect to the un- and re-loading of kernel modules.

Manually suspending to RAM

'/sys/power/state' contains values for the possible suspension mechanisms supported by the kernel. If it contains “mem” then the machine supports suspending to RAM. It can be triggered by echoing “mem” into the file. This can only be done with root permission, so issue

echo mem | sudo tee /sys/power/state

If this command should fail then one may need to un-load some kernel modules beforehand. Check dmesg as well as the system log to find out more (cf. the forum forum to get an idea).

PM-utils

PM-utils is a suite of commands that handle kernel modules in the context of suspending to RAM or disk. The following code prints out the supported methods.

for i in --suspend --hibernate --suspend-hybrid; do pm-is-supported $i && echo "$(echo $i | tr [:lower:] [:upper:] | tr -d -) is supported"; done 

Suspending

Suspending to RAM is issued through

sudo pm-suspend

Hibernation

PM-utils does hibernation, i.e. suspending to disk, as well and should put the computer safely to sleep. A swap partition must exist, of course, and dCore will detect and use it on its own (unless the NOSWAP boot-code was set).

In order for the system to know at boot where it should look for hibernation data, the kernel parameter resume= must be included in the boot stanza. It takes a device file name as paramater. (Contrary to what the above linked docs say, I have been unable to successfully use PARTUUID=<uuid> or UUID=<uuid>.)

Adding menu entries to Openbox for suspending

Making the commands for suspending available through the Openbox menu is similar the menu tweaks applied to LXDE.

First create '~/.config/openbox/pm-utils.xml' with the following content.

<?xml version="1.0" encoding="UTF-8"?> <openbox_menu xmlns="http://openbox.org/3.5/menu">
<menu id="pm-utils-menu" label="PM-Utils">
<item label="Suspend"> <action name="Execute"><command>sudo pm-suspend</command> </action> </item>
<item label="Hibernate"> <action name="Execute"> <command>sudo pm-hibernate</command> </action> </item>
</menu> </openbox_menu>

Then add a reference to this file in '~/.config/openbox/rc.xml' (or '~/.config/openbox/lxde-rc.xml' when using LXDE). That is, add <file>pm-utils.xml</file> to the <menu>-section (around line 601 in 'rc.xml', line 541 in 'lxde-rc.xml').

Finally, make the menu available by adding <menu id=“pm-utils-menu”/> to the section <menu id=“root-menu” label=“Openbox 3”> of '~/.config/openbox/menu.xml'.

After selecting “Reconfigure Openbox” from “System” in the Openbox menu (right-click on the desktop), the new sub-menu is available.

Print/export
QR Code
QR Code dcore:suspending (generated for current page)