Search:  
Gentoo Wiki

HOWTO_Software_Suspend_v2

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
This page is a candidate for deletion 
Reason given: As of the end of 2007 (version 3.0), suspend2 has been renamed to TuxOnIce. The website has moved to http://tuxonice.net and all packages have been renamed accordingly. All information in originally in this article has been migrated to TuxOnIce wiki page. Any information found here applies to things before the renaming.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.


Using Suspend2 with initrd/initramfs

Using an initrd with Suspend2 is possible. To use this, you MUST edit your linuxrc (or init) script to contain the line

File: linuxrc
# if using version suspend2-sources < 2.6.18 and hibernate-script < 1.93 :
echo > /proc/suspend2/do_resume
# else (suspend2-sources >= 2.6.18 and hibernate-script >= 1.93) :
echo > /sys/power/suspend2/do_resume

(with init, only the actual 'echo' line is needed).

BEFORE the script mounts your filesystem. If the line is missing, your system will not resume. If the line comes after mounting file systems, you will most likely suffer from filesystem corruption.

UPDATE: 15 Dec 2005 ----------------

1) On some systems, depending on kernel version the above line may need to be:

File: linuxrc
echo > /proc/software_suspend/do_resume

2) If you are using an older version of genkernel the linuxrc file used to create the image lies in /usr/share/genkernel/generic/linuxrc. Therefore, to include such a line, change it as follows:

File: linuxrc
# Suspend2: Resume if applicable
mount -t proc proc /proc
echo > /proc/software_suspend/do_resume
mount -o remount,rw /

or

# Suspend2: Resume if applicable
mount -t proc proc /proc
echo > /proc/suspend2/do_resume
mount -o remount,rw /

or (when using 2.6.18 and hibernate 1.93) - must mount /sys

mount -t proc proc /proc >/dev/null 2>&1
mount -t sysfs sys /sys
echo > /sys/power/suspend2/do_resume
/bin/busybox umount /sys

or (still with 2.6.18 and hibernate 1.93), update at the end of your linuxrc file :

exec /bin/busybox chroot . /bin/sh <<- EOF
# SUSPEND2
mount -t sysfs none /sys
mount -t proc proc /proc >/dev/null 2>&1
echo > /sys/power/suspend2/do_resume
umount /proc ; umount /sys ; mount -o remount,rw / >/dev/null 2>&1
#
exec /sbin/init ${REAL_INIT}

Note : if you get a warning at boot from fsck telling you your partition is already mounted and should not be checked, try removing the 'mount -o remount,rw / > /dev/null 2>&1' command.


Make sure the echo is before any mount commands (other than proc, which is needed and isn't a real filesystem), or you may suffer from filesystem corruption!


UPDATE: 15 Dec 2005 ----------------

You can now recompile your kernel with TuxOnIce...

UPDATE: 21 Dec 2005

The insertion of this echo was tricky for me. The following one worked for me (dell precision M70) : this is a patch on /usr/share/genkernel/generic/linuxrc:

...
  exec /bin/busybox chroot . /bin/sh <<- EOF
+ mount -t proc none /proc
+ echo > /proc/software_suspend/do_resume
+ umount /proc ; mount -o rw,remount /
  exec /sbin/init ${REAL_INIT}
  EOF
...

Basically, this patch wait for the real root filesystem before calling software_suspend-2.2-rc6 with kernel 2.6.13-suspend2-r4 and genkernel-3.3.6. BEWARE, I got filesystem CORRUPTIONS without the remount here; I also replaced mount -o rw ${REAL_ROOT} ${NEW_ROOT} by mount -o ro ${REAL_ROOT} ${NEW_ROOT} in the same file. After modifying this file, do

genkernel initrd; lilo
-- daajaa@gmail.com
Retrieved from "http://www.gentoo-wiki.info/HOWTO_Software_Suspend_v2"

Last modified: Mon, 25 Aug 2008 02:28:00 +0000 Hits: 180,988