[CentOS] CentOS 5.0 suspend to disk (hibernate) - solved

Mon Jun 25 17:44:51 UTC 2007
Roland Renaud <roland_renaud at mitel.com>

Dag Wieers writes: (On Mon, 11 Jun 2007)
| On Tue, 1 May 2007, Roland Renaud wrote:
| 
| > The RHEL 5 release notes for their desktop version claim
| >  "Improved ACPI support with features such as suspend to disk"
| > but this isn't working with CentOS 5.
...
| > Are there some packages or a different kernel that should be installed?
...

| Hibernate to disk and suspend to memory both work on my T43 with CentOS 5.
| My feeling is this is mostly related to the graphical card. I have an 
| Intel 915M, and I know the ATI version is known to have more problems.
| 
| For me I only needed to add a kernel boot option (acpi_sleep=s3_bios).
| 
| A very important resource for Linux problems with your thinkpad is 
| ThinkWiki:
| 
| 	http://www.thinkwiki.org/wiki/ThinkWiki
| 
| Almost every problems is discussed in detail (in a distribution-agnostic 
| way) and solutions are provided.
| 
| 	http://www.thinkwiki.org/wiki/Problems_with_ACPI_suspend-to-ram
| 	http://www.thinkwiki.org/wiki/Problem_with_display_remaining_black_after_resume


Thanks for your reply Dag.

Sorry for not responding sooner.  I was hoping to report on a fix for
the xen kernel but haven't yet had time to resolve that problem.

I got suspend to ram and suspend to disk working on May 27 but didn't
follow up since no one on this list seemed interested in this thread.

The graphical card was never an issue for me; the machine wouldn't
suspend in the first place.

I've included some notes for those who might have similar troubles.


SUMMARY:
- I knew about adding "acpi_sleep=s3_bios" to the kernel boot parameters.
- Using that, and "resume=/dev/sda2" (my swap partition) did the trick.
- But not for the xen kernel.
- Reference information in  
      http://thinkwiki.org/wiki/Swsusp
- A quick way to tell if it's going to work is to run
    "lshal |grep suspend"
      ...
      power_management.can_suspend_to_disk = true  (bool)
      power_management.can_suspend_to_ram = true  (bool)
      power_management.can_suspend = true  (bool)
- The kernel provided by CentOS does support suspend to ram and
  suspend to disk.


DETAILS:

- When using GNOME to suspend or hibernate the computer it points to
  the following website, implying that the feature isn't available in
  the kernel.

  http://live.gnome.org/GnomePowerManager/FAQ

    Entry:
    8. Why does GNOME Power Manager not let me suspend or hibernate?
       Says:

    % lshal | grep suspen
      ...
      power_management.can_suspend_to_disk = false  (bool)
      power_management.can_suspend_to_ram = true  (bool)
      power_management.can_suspend = true  (bool)


- Get and install the kernel source:
	http://wiki.centos.org/HowTos/I_need_the_Kernel_Source
    % yum list 'kernel*'
      ...
    % yum install 'kernel*'
	...
	Total download size: 63 M

    http://mirror.centos.org/centos/5/os/SRPMS/
    Got kernel-2.6.18-8.el5.src.rpm from above and installed it.

    rpmbuild -bp --target i686 kernel-2.6.spec


    That produces a config file in
      /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/.config


- It looks like the kernel does support the suspend.
  This can be viewed in the config file

    % grep SUSPEND .config
	CONFIG_SOFTWARE_SUSPEND=y
	CONFIG_SUSPEND_SMP=y
	# CONFIG_APM_IGNORE_USER_SUSPEND is not set
	# CONFIG_USB_SUSPEND is not set

  It can also be viewed via the kernel config gui
    % make xconfig &


- This ThinkWiki page provides the answer

    http://thinkwiki.org/wiki/Swsusp
	...
	NOTE!
	For some people suspending did not work if resume_partition was
	specified in the kernel config. In such case specify the resume
	partition as a kernel parameter instead.


- All that's required is to add this to the boot parameters:
  resume=/dev/resume_partition  (swap partition)
  resume=/dev/sda2


- Add this to grub and boot from this config.
  Added to grub:
    title CentOS (2.6.18-8.1.4.el5 hibernate)
	    root (hd0,0)
	    kernel /vmlinuz-2.6.18-8.1.4.el5 ro root=LABEL=/ rhgb resume=/dev/sda2 acpi_sleep=s3_bios quiet
	    initrd /initrd-2.6.18-8.1.4.el5.img


- Now lshal looks better
      % lshal | ma susp disk
        ...
	power_management.can_suspend_to_disk = true (bool)
	power_management.can_suspend_to_ram = true  (bool)
	power_management.can_suspend = true  (bool)

- It can now suspend to ram or disk using gnome or these commands:

  To suspend to ram:
    echo mem > /sys/power/state

  To suspend to disk:
    echo disk > /sys/power/state


- ThinkWiki is an excellent resource that I've known about for quite
  some time.
  Why didn't I notice the note on the Swsusp page earlier?

  I've tried the suggestions on this page in the past but with kernels
  that didn't support them.  I still can't get it working with the xen
  kernel.


Thanks again Dag.

Thanks also to the CentOS team and this mailing list for their
software and their support.


roland