# Is there a sleeping program that works out of the box?

## xiaweitang

I tried both pm-utils and suspend packages and with various options, but nothing works. Why is it so difficult for a linux program to work out of the box, like in windows? Is it the price we have to pay to get free software and more control of the operating system?

----------

## Rexilion

You don't provide much info, where does stuff go wrong? Any error messages?

----------

## Hu

Hibernation worked out of the box for me on the systems where I tested it within the last year or so.  Please explain the problems you saw in more details.  Are you trying to sleep or to hibernate?  If you tried to sleep, beware that this requires BIOS support and there are many BIOSes that are at least slightly wrong.  Hibernation is easier, because it is almost entirely controlled by Linux.  Which kernel sources did you use?  What are the version numbers of all the relevant packages?  Did the system fail to go down or fail to come back?

----------

## BK201

tuxonice works for me out of the box. You will have to patch your kernel to use it though, or use one that includes it.

----------

## xiaweitang

Both pm-suspend and pm-hibernate bring down the system but neither brings the system back. In the case of pm-suspend, the LED lights are coming back, but the screen is black, and Ctrl-Alt-Bksp can't even reboot the system. In the case of pm-hibernate, the system simply reboots, not resume. 

The kernel is 2.6.32-gentoo-r7

The version of pm-utils is 1.3.0

and the /var/log/pm-suspend.log

```
Initial commandline parameters: 

Sun May  2 23:20:36 EDT 2010: Running hooks for suspend.

/usr/local/lib/pm-utils/sleep.d/00logging suspend suspend:Linux tux 2.6.32-gentoo-r7 #3 Tue Apr 20 04:40:27 EDT 2010 i686 Intel(R) Celeron(R) M CPU 410 @ 1.46GHz GenuineIntel GNU/Linux

Module                  Size  Used by

             total       used       free     shared    buffers     cached

Mem:       1541744      74884    1466860          0      13720      30720

-/+ buffers/cache:      30444    1511300

Swap:      2104504          0    2104504

success.

/usr/local/lib/pm-utils/sleep.d/00powersave suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/01grub suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/49bluetooth suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/55NetworkManager suspend suspend:success.

/usr/local/lib/pm-utils/sleep.d/75modules suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/90clock suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/94cpufreq suspend suspend:success.

/usr/local/lib/pm-utils/sleep.d/95led suspend suspend:not applicable.

/usr/local/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:success.

/usr/local/lib/pm-utils/sleep.d/99video suspend suspend:kernel.acpi_video_flags = 0

Allocated buffer at 0x2010 (base is 0x0)

ES: 0x0201 EBX: 0x0000

success.

Sun May  2 23:20:37 EDT 2010: performing suspend
```

The BIOS support should be there because suspend works in Arch Linux.

----------

## Hu

 *xiaweitang wrote:*   

> Both pm-suspend and pm-hibernate bring down the system but neither brings the system back. In the case of pm-suspend, the LED lights are coming back, but the screen is black, and Ctrl-Alt-Bksp can't even reboot the system.

 Ctrl-Alt-Bksp never reboots the system.  In older versions of X, it could kill the X server.  This sounds like the typical problem of the video card not being resumed correctly.  If I recall correctly, the BIOS is supposed to do this, but many do not.  When the BIOS fails to do this, userspace must emulate it.  What video card do you have?  Does it matter whether you suspend from text mode?

 *xiaweitang wrote:*   

> In the case of pm-hibernate, the system simply reboots, not resume.

 What error message(s) does your initrd produce before it goes on to start the system?

----------

## xiaweitang

 *Hu wrote:*   

>  *xiaweitang wrote:*   Both pm-suspend and pm-hibernate bring down the system but neither brings the system back. In the case of pm-suspend, the LED lights are coming back, but the screen is black, and Ctrl-Alt-Bksp can't even reboot the system. Ctrl-Alt-Bksp never reboots the system.  In older versions of X, it could kill the X server.  This sounds like the typical problem of the video card not being resumed correctly.  If I recall correctly, the BIOS is supposed to do this, but many do not.  When the BIOS fails to do this, userspace must emulate it.  What video card do you have?  Does it matter whether you suspend from text mode?
> 
>  *xiaweitang wrote:*   In the case of pm-hibernate, the system simply reboots, not resume. What error message(s) does your initrd produce before it goes on to start the system?

 

Sorry, I meant Ctrl-Alt-Del. 

The video card is intel 945GM. If I suspend from text mode, it will resume. However, after the resume, I type startx, then the screen goes black again, and the keyboard doesn't respond. 

In the case of hibernate, what is initrd? I didn't see it in the installation procedures of Gentoo.

----------

## Hu

Do the keyboard LEDs begin blinking when the screen blacks out?

 *xiaweitang wrote:*   

> In the case of hibernate, what is initrd? I didn't see it in the installation procedures of Gentoo.

 It is the initial ramdisk.  It may also be called initramfs, which is the newer and preferred way of doing early userspace.  Although some very simple hibernation setups can function without an initrd, most of the interesting and desirable configurations require an initrd/initramfs to direct the resume procedure, since you cannot safely mount a partition which was mounted when the system hibernated.  In theory, you could have a spare partition with an alternate root to guide the resume, but it is much simpler to do it from an initramfs.

----------

## xiaweitang

 *Hu wrote:*   

> Do the keyboard LEDs begin blinking when the screen blacks out?
> 
>  *xiaweitang wrote:*   In the case of hibernate, what is initrd? I didn't see it in the installation procedures of Gentoo. It is the initial ramdisk.  It may also be called initramfs, which is the newer and preferred way of doing early userspace.  Although some very simple hibernation setups can function without an initrd, most of the interesting and desirable configurations require an initrd/initramfs to direct the resume procedure, since you cannot safely mount a partition which was mounted when the system hibernated.  In theory, you could have a spare partition with an alternate root to guide the resume, but it is much simpler to do it from an initramfs.

 

It's a laptop. The LED is not blinking. It stays on or off.

How to set up initramfs?

----------

## xiaweitang

I have got TuxOnIce working with hibernate, but hibernate-ram still can't get me resumed.

----------

## xiaweitang

Anybody know how to get /etc/conf.d/local.start restarted after resume? I have a script in it to disable the wifi LED blinking. After resume, the LED blinks again.

----------

## Hu

See man hibernate.conf for the directive OnResume, which will let you run an arbitrary shell statement during resume.  You could use this statement to run local.start or some other program that provides equivalent behavior.

----------

## xiaweitang

 *Hu wrote:*   

> See man hibernate.conf for the directive OnResume, which will let you run an arbitrary shell statement during resume.  You could use this statement to run local.start or some other program that provides equivalent behavior.

 

This works but only when the duration of the hibernation is short.

----------

