Difference between revisions of "Suspend"

From LinuxMCE
Jump to: navigation, search
(Enable wake on lan)
(Added part about reloading lirc modules)
Line 29: Line 29:
  
 
Edit the /etc/hibernate/ram.conf file, and comment the two lines  
 
Edit the /etc/hibernate/ram.conf file, and comment the two lines  
  EnableVbeTool yes
+
  #EnableVbeTool yes
  VbetoolPost yes
+
  #VbetoolPost yes
  
Edit the /etc/hibernate/blacklisted-modules, and comment the ''nvidia'' line.
+
Edit the /etc/hibernate/blacklisted-modules, and comment the line:
 +
#nvidia
  
  
Line 45: Line 46:
 
     ethtool -s eth0 wol g
 
     ethtool -s eth0 wol g
 
  }
 
  }
 +
 +
 +
== Lirc module unloading and reloading ==
 +
 +
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
 +
    fi
 +
}
 +
 +
StartLirc() {
 +
    /etc/init.d/lirc start
 +
}
 +
  
 
== To suspend the MD ==
 
== To suspend the MD ==
Line 54: Line 78:
 
  USuspendRamForce yes
 
  USuspendRamForce yes
 
line, to force it to suspend anyway.
 
line, to force it to suspend anyway.
 
  
 
== References ==
 
== References ==

Revision as of 15:55, 22 December 2007

This article describes how to suspend your MD to RAM.


Motivation

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

Setup

There are several different ways of achiving suspend, this is one using the hibernate scripts, which can be configured to use different ways of suspending the machine.

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:

#nvidia


Enable wake on lan

To enable wake on lan, to let the core wake up the MD, you have to run a command to enable this before going to sleep. The normal shutdown process does this, but this is not run when suspending the computer. Hibernate provides a way of including our own scripts before suspending.

Add a file (i.e. enableWOL) to the /etc/hibernate/scriptlets.d/ folder:

AddSuspendHook 15 EnableWOL

EnableWOL() {
    ethtool -s eth0 wol g
}


Lirc module unloading and reloading

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
    fi
}

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


To suspend the MD

Then run

hibernate-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.

References

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