From LinuxMCE
Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 working 9 Sept 2010 sambuca
1004 Unknown N/A N/A
1204 Unknown N/A N/A
Usage Information

This article describes how to suspend your MD to RAM (standby) or to disk (hibernation).

As of LinuxMCE 810, the suspend framework is integrated in LMCE. But please note that you might have to do some configuration for your particular hardware.


  • Saving power
  • Quick boot (usefull if your MD is noisy and you turn it off when not in use)


The "Power off MD" button on the orbiter will send a Off command to the MD, without specifying suspend or halt. As default, this will halt (power off) the MD, but it can be overridden to suspend instead. To change this, open the advanced page for your MD and fine the "PowerOff Mode" data. Setting this value to "S" will suspend it, "H" will halt it.

In the web admin => restart there is a button "Suspend" for each MD. Pressing this button will suspend the MD. You can also suspend the MD from the command line by calling pm-suspend.

Its also possible to have the physical power button start the suspend. To do this you need to call pm-suspend from the appropriate acpi script (/etc/acpi/ will do).

Wake on LAN

Wake on LAN from a suspended state is currently (810) a little broken for some network cards. Even though it may work from the powered down state, waking from the suspended state may not.

Using NVidia graphics card

not verified that this is required in 810

Edit your xorg.conf file and add this line to the "Device" section:

Option "NvAGP" "1"

Also make sure no other vendor AGP modules are loaded, like intel_agp, sis_agp etc. The agpgart module is fine, though. Use

lspci | grep agp

to list all loaded agp modules.

If you see any agp modules besides agpgart, add a line to /etc/modprobe.d/blacklist to blacklist the module.

LinuxMCE 710

Setup using PM-Utils in 710

PM-utils is the package in Ubuntu that are responsible for suspending and resuming your computer. It uses the HAL database to find information about what special tricks it need to pull off to get your particular hardware to successfully resume.

The setup for pm-utils was tested after completing the hibernate setup below, so you may have to include some parts of that to get this to work. In particular the NVidia part may be required.

Install pm-utils

apt-get install pm-utils

Create a file /etc/pm/sleep.d/01lmce


. /usr/lib/pm-utils/functions

case "$1" in

exit $RETVAL

Create a file /usr/pluto/bin/


/usr/bin/screen -d -m -S "LMCE Launch Manager" /usr/pluto/bin/

Create a file /usr/pluto/bin/


. /usr/pluto/bin/
. /usr/pluto/bin/
. /usr/pluto/bin/pluto.func

echo "LMCE Suspend Process Started"

## Turn on WOL


## Find local IP address

LocalIP=$(ip addr show dev eth0|grep "inet "|cut -f6 -d" "|cut -f1 -d/)

## Use local IP address to find MD device number

FindMDDeviceQ="SELECT PK_Device FROM Device
		WHERE IPAddress='$LocalIP';

DeviceID=$(RunSQL "$FindMDDeviceQ")

## Identify immediate children DCE devices that are currently Registered
FindChildrenQ="SELECT Device.PK_Device
		FROM Device
		JOIN DeviceTemplate ON Device.FK_DeviceTemplate=DeviceTemplate.PK_DeviceTemplate
		LEFT JOIN Device AS Device_Parent on Device.FK_Device_ControlledVia=Device_Parent.PK_Device
		LEFT JOIN DeviceTemplate AS DeviceTemplate_Parent
		ON Device_Parent.FK_DeviceTemplate=DeviceTemplate_Parent.PK_DeviceTemplate
		WHERE (Device.FK_Device_ControlledVia=$DeviceID
		OR (Device_Parent.FK_Device_ControlledVia=$DeviceID AND DeviceTemplate_Parent.FK_DeviceCategory IN (6,7,8) ) )
		AND DeviceTemplate.FK_DeviceCategory <> 1
		AND DeviceTemplate.ImplementsDCE=1
		AND Device.Registered=1;

DeviceList=$(RunSQL "$FindChildrenQ")

## Send SYSCOMMAND_0 (device shutdown) message to all immediate children. These devices will relay the message to all decendents

for Device in $DeviceList; do

	/usr/pluto/bin/MessageSend "$DCERouter" 0 "$Device" 7 0 163 "start_local_devices"


## Send SYSCOMMAND_0 message to MD device itself
/usr/pluto/bin/MessageSend dcerouter 0 $DeviceID  7 0 163 "start_local_devices"

## Wait for DCE devices to complete their shutdown

for ((i = 0; i < MaxLoopCount; i++)); do
	Devices=$(cat /usr/pluto/locks/pluto_spawned_local_devices.txt | grep -v '^$' | tr '\n' ',')
	 if [[ -z "$Devices" ]]; then
	Q="SELECT COUNT(*) FROM Device WHERE PK_Device IN ($Devices) AND Registered=1"
	RegCount=$(RunSQL "$Q")
	if [[ "$RegCount" -eq 0 ]]; then 
	echo "Waiting for $RegCount devices to shutdown ($Devices)"
	sleep 1
echo "Done waiting"

## Kill the LM processes
killall -q -s SIGKILL -r lmce_launch_manager\*

Make sure all three scripts are executable

chmod +x <script>

Reboot the MD, and that's it. The setup is complete. You can try to suspend by typing pm-suspend. The suspend can take some time as LMCE is stopping the devices on your MD. If your hardware is supported, it will resume and restart lmce.

Setup using hibernate

It is now recommended to use the pm-utils way of suspending. This way may still work though.

On the MD in question, make sure you have the uswsusp and hibernate packages installed.

apt-get install uswsusp hibernate

Check your BIOS setting to make sure that suspend to ram is enabled.

Using NVidia graphics card

Edit your xorg.conf file and add this line to the "Device" section:

Option "NvAGP" "1"

Also make sure no other vendor AGP modules are loaded, like intel_agp, sis_agp etc. The agpgart module is fine, though. Use

lspci | grep agp

to list all loaded agp modules.

If you see any agp modules besides agpgart, add a line to /etc/modprobe.d/blacklist to blacklist the module.

Edit the /etc/hibernate/ram.conf file, and comment the two lines

#EnableVbeTool yes
#VbetoolPost yes

Edit the /etc/hibernate/blacklisted-modules, and comment the line:


Lirc module unloading and reloading

Not needed for 710

Some lirc modules (at least lirc_serial) needs reloading after suspend. Like for enabling wol, we add a file in the /etc/hibernate/scriptlets.d/ folder, with a descriptive name lirc.

# Stops and unloads the current lirc module before suspending, and
# restarts lirc when resuming

AddSuspendHook 30 UnloadLirc
AddResumeHook 30 StartLirc

UnloadLirc() {
    /etc/init.d/lirc stop
    if [ -f /etc/lirc/hardware.conf ];then
        . /etc/lirc/hardware.conf
        rmmod $MODULES

StartLirc() {
    /etc/init.d/lirc start

Suspend to RAM



to suspends the MD to ram. The script first checks if it recognizes your hardware, to take the correct actions before suspending. If you get a message that your machine is unknown, edit the /etc/hibernate/ususpend-ram.conf file, and un-comment the

USuspendRamForce yes

line, to force it to suspend anyway.

Suspend to disk / Hibernation

Before trying to set up suspend to disk, I recommend that you first get suspend to ram working. All setup needed for suspend to RAM is also required for suspend to disk.

To enable suspend to disk, you will need to set up a swap partition on the MD in question. This is because the suspend implementation in the current kernel can only save the memory to the swap area. To achieve this on a diskless MD, you might use a CF card and a CF/IDE adapter. A CF card with 1 or 2 GB should be sufficient. However, with a CF card, you should make sure your MD has enough physical ram to avoid using swap, because CF cards may have lower performance than a normal IDE disk.

Edit the /etc/fstab file for the MD and add an entry for the swap partition

/dev/sda1 none            swap    sw              0       0

Adjust the partition to match your swap partition. Make sure you select the right one, or you WILL destroy your data. In the case of a diskless MD, you will probably only have one partition (a CF card for instance). You might need to do partitioning on the disk if it is a empty disk. This is outside the scope of this article.

Copy two files from /usr/share/initramfs-tools/scripts/local-premount/ (resume, uswsusp) into /etc/initramfs-tools/scripts/nfs-premount/ Not sure if both files are required, but it doesn't hurt.

These scripts will run before any file systems have been mounted, and after any disk drivers has been loaded. Both are important: mounting any file systems before resuming can corrupt your data, according to the documentation. And we need to have the drivers loaded to access the suspended image.

After copying the two files, run

update-initramfs -u

to update the initramfs image, which includes the scripts in the boot up process.

Now reboot your MD. When it has started up again, you can type


to initiate suspend to disk.


The hibernate script uses uswsusp by default when trying to suspend to ram. For more information about the s2ram utility used, read the S2ram howto

The NVidia suspend howto