# pm-hibernate does not hibernate

## jody

Hi

I have an Acer Aspire 7520, and have installed pm-utils successfully, as far as i can see:

the commands pm-suspend and pm-hibernate are found, and the gnome shut-down panel 

contains the buttons "Suspend" and "Hibernate"

However, when i enter pm-hibernate in a terminal (as root), the laptop turns itself of after 

some disk activity, but when i power up again, it does a normal start, as if freshly booted.

The same behaviour occurs when i press "Hibernate" in the gnome panel.

All suspend-related entries (i know of) in my config:

```
 CONFIG_ARCH_SUSPEND_POSSIBLE=y

CONFIG_SUSPEND=y

CONFIG_SUSPEND_FREEZER=y

CONFIG_X86_GX_SUSPMOD=m

# CONFIG_USB_SUSPEND is not set

```

Does anybody have an idea how to make pm-hibernate do a real hibernation?

Thank You

   Jody

----------

## Hu

When the system starts, does it warn that it was shutdown improperly?  That will tell us the difference between hibernate being converted into a shutdown versus a successful hibernate followed by the system not resuming.

How do you ask the system to resume instead of booting normally?  Are you using the in-kernel software suspend or the TuxOnIce patches?  What kernel version are you using?  Where is the suspend image written, and are you sure that the image is available during resume?

----------

## jody

Hi

Thank you for your reply. Because i have only small knowledge 

about the suspension functions, i may not answer all your questions satisfactorily...

 *Quote:*   

> When the system starts, does it warn that it was shutdown improperly?

 At restart, there is no message indicating a failure of hibernation.

 *Quote:*   

> How do you ask the system to resume instead of booting normally?

 I'm not sure i understand this question. When i do pm-hibernate, the computer turns it self off

after some disk activity. After that i press the power button to start it again. 

With my other computer at work, that's how i hibernate it and wake it up again.

 *Quote:*   

> Are you using the in-kernel software suspend or the TuxOnIce patches? 

 I don't really know for sure, but guess it is in-kernel, because i didn't specify anything about TuxOnIce

 *Quote:*   

> What kernel version are you using?

 

```
Linux localhost 2.6.30-gentoo-r4 #1 SMP Sun Sep 27 13:05:16 CEST 2009 i686 AMD Turion(tm) 64 X2 Mobile Technology TL-60 AuthenticAMD GNU/Linux

```

 *Quote:*   

> Where is the suspend image written, and are you sure that the image is available during resume?

 I have no idea - how can i find this out?

By the way: The 'Suspend' command works correctly.

Thank You

  Jody

----------

## Hu

If you have not specified otherwise, the kernel will not attempt to read the hibernation image, and will instead behave as though the system is being restarted after a power failure.  Therefore, it will boot normally, and may show messages indicating that filesystems were not cleanly unmounted.  It is possible, and often desirable, to request a resume operation as your default boot option, and rely on the resume code to ignore that and perform a normal boot at those rare times that the system truly was shutdown.

To find the location of the hibernation image, check the configuration file for your hibernation tool.  I use the hibernate script from TuxOnIce, which has a separate configuration file, so I cannot say where to look.

----------

## kani

Hey jody,

you gotta adjust your grub/menu.lst with the resume-parameter:

```

# vim /boot/grub/menu.lst

```

Add accordingly your SWAP-partition ("resume=/dev/..." ).

```

...

kernel /[kernel] root=/dev/[sdaX] resume=/dev/[sdaX]

...

```

kind regards

----------

## jody

Hi Kani

Thank you for your suggestion - it brought me halfway there.

This

```
kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r4-ok2 root=/dev/sda2 resume=/dev/sda2
```

(swap is sda2) did not work - it couldn't properly boot.

Now my entry in grub.conf (i.e. menu.lst) is

```
title Gentoo Linux 2.6.30-r4 (resume)

root (hd0,0)

kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r4-ok2 root=/dev/sda2 real_root=/dev/sda3 real_resume=/dev/sda2

initrd /boot/initramfs-genkernel-x86-2.6.30-gentoo-r4-ok2

```

With this configuration it sometimes hibernates, and sometimes it doesn't.

I haven't yet been able to determine, what the causes foor non-hibernation are....

I suspect that when i have many applications open (terminals, firefox & gimp, forinstance)

then it doesn't hibernate. In this case, ometimes it starts again as if had asked it to reboot, 

sometimes it goes to sleep, but boots normally when started again.

Is it possible that my swap is too small?

```
localhost jody # /sbin/fdisk -l /dev/sda

Disk /dev/sda: 250.0 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x760ad23d

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1           5       40131   83  Linux

/dev/sda2               6          68      506047+  82  Linux swap / Solaris

/dev/sda3              69       30401   243649822+  83  Linux

```

```
localhost jody # cat /proc/meminfo | grep Total

MemTotal:        1813716 kB

HighTotal:        925000 kB

LowTotal:         888716 kB

SwapTotal:        506036 kB

VmallocTotal:     122880 kB

```

If my swap is too small - is there a possibility to increase its size, without having

to reinstall everything again?

Thank You

  Jody

----------

## Hu

The system should refuse to hibernate, and instead remain running, if you have insufficient swap to store the hibernation image.  The exact behavior varies depending on the code used, but the s2disk approach does this, and I think the TuxOnIce code does so as well.

----------

## jody

Hi

Available space certainly was a problem: 

Yes, i checked the log file '/var/log/pm-suspend.log', and there seems to be a space issue: *Quote:*   

> 
> 
> [... many lines ...]
> 
> pata_sis                9760  1 sata_sis
> ...

 

Clearly the system wanted to hibernate, found that there is not enough space (if iremember correctly,

my swap-partition is only 512M, whereas i have 2G RAM), and restarted again.

So i decided to go for tuxonice, which apparently offers the possibility to use a file to save the state.

But following the instructions at http://en.gentoo-wiki.com/wiki/TuxOnIce i got stuck

after emerging tuxonice-sources. In my menuconfig, there was no entry 

```
Power management options (ACPI, APM)  --->
```

so i don't know how to proceed. It probably is the newest version of tuxonice, i did an 'emerge --sync' just this morning.

(my kernel is '2.6.30-gentoo-r4')

Can you give me some diections how i could properly install tuxonice?

Thank You

  Jody

----------

## Hu

Unfortunately, no.  I use the in-kernel suspend support.

----------

## jody

Is in-kernel suspend the pm-utils way?

if yes, is it possible to use a file instead of the swap partition?

if yes, how would i have to go on about it?

Thank YOu

  Jody

----------

## Hu

I do not use pm-utils, so I cannot say.  I use a swap partition that is large enough for the full image, so I never tested with a swapfile.  Documentation/power/swsusp-and-swap-files.txt seems to indicate that it works, though it looks like it is more trouble than using a swap partition.  That file explains how to configure the resume side of the work.  Since nothing special is said about the suspend side, it probably works without extra configuration.

----------

## fixhalleluja

 *Kani wrote:*   

> 
> 
> Add accordingly your SWAP-partition ("resume=/dev/..." ).
> 
> ```
> ...

 

Well, THAT was a mistake. It has to be:

```

...

kernel /[kernel] root=/dev/[sdaX] resume=/dev/[sdaY]

...

```

Since you want to add your SWAP-partition, the 'resume' and the 'root' parameter cannot be identical. (You don't have your / directory on your swapdrive, don't you)

The post that followed the above-mentioned lets assume that poor Jody made that mistake.

But with the SWAP-drive as the resume parameter my system hibernates correctly now (I JUST DID IT!! -- TWICE!!)..

So, thanks to Kani !!!

Bye.

----------

## melinux

I had a problem when I upgraded to pm-utils 1.4.1 from 1.30-r2. It just wouldn't hibernate when I called pm-hibernate as root.

So I had to revert back and now it's working again.

Anyone have this problem too? 

Seems like there's a bug with the latest version.

----------

## jody

I have a similar problem:

I freshly installed 2.6.35-gentoo-r4 and as usual  set the appropriate options in the kernel configuration

```

    [*] Hibernation (aka 'suspend to disk') 

        (/dev/sda2) Default resume partition
```

 where /dev/sda2 is about 2GB. 

My grub.conf

```
default 0

timeout 3

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.35-r4

root (hd0,0)

kernel /boot/kernel-genkernel-x86-2.6.35-gentoo-r4 root=/dev/ram0 real_root=/dev/sda3 resume=/dev/sda2

initrd /boot/initramfs-genkernel-x86-2.6.35-gentoo-r4
```

My pm-utils was version 1.4.1

Hibernation did not work.

Now i downgraded pm-utils to 1.3.0-r2 but ist still doesn't hibernate...  :Sad: 

jody

----------

## melinux

 *jody wrote:*   

> I have a similar problem:
> 
> I freshly installed 2.6.35-gentoo-r4 and as usual  set the appropriate options in the kernel configuration
> 
> ```
> ...

 

Your RAM is 2G right?

----------

## jody

 *Quote:*   

> Your RAM is 2G right?

 

Yes, this is correct.

----------

## jody

I just saw that according to /var/log/pm-suspend.log my computer really does hibernate:

```

(*snip*)

/usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate:success.

/usr/lib/pm-utils/sleep.d/01grub hibernate hibernate:disabled.

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

/usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate:disabled.

/usr/lib/pm-utils/sleep.d/75modules hibernate hibernate:success.

/usr/lib/pm-utils/sleep.d/90clock hibernate hibernate:disabled.

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

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

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

/usr/lib/pm-utils/sleep.d/99video hibernate hibernate:success.

Wed Sep 15 20:53:55 CEST 2010: performing hibernate
```

So this seems to indicate that it somehow fails to wake up properly, is that correct?

----------

## melinux

 *jody wrote:*   

> I just saw that according to /var/log/pm-suspend.log my computer really does hibernate:
> 
> ```
> 
> (*snip*)
> ...

 

It could be.. in my case it was not hibernating completely at all.

----------

## jody

I now finally found the problem:

In grub.conf i changed the line

```
kernel /boot/kernel-genkernel-x86-2.6.35-gentoo-r4 root=/dev/ram0 real_root=/dev/sda3 resume=/dev/sda2
```

to

```
kernel /boot/kernel-genkernel-x86-2.6.35-gentoo-r4 root=/dev/ram0 real_root=/dev/sda3 real_resume=/dev/sda2
```

and now it wakes up again correctly!

----------

## kernelOfTruth

guys - care to explain a little bit what it does when it "wakes up" ?

for me it actually hibernates (saying "performing hibernate") - I also see it writing stuff to the swap-partition

but it doesn't resume   :Sad: 

I have / (root) and swap on an encrypted LVM named GENTOO so:

1) LUKS (encrypted) -> LVM ("GENTOO") -> ROOT, SWAP

so I first have to enter a password to open the LVM -> both volumes are detected -> starts to boot

2) the commands for grub.conf shall be:

crypt_root=/dev/sdd7 real_root=/dev/mapper/GENTOO-ROOT real_resume=/dev/mapper/GENTOO-SWAP resume=/dev/mapper/GENTOO-SWAP

4) I'm manually hibernating via

pm-hibernate

5) anything I'm missing ?

because everytime I'm turning my computer back on it simply invalidates the swap-resume information (it actually finds a signature of hibernate/suspend) and continues to boot up normally

many thanks in advance

pm-suspend works fine, btw

----------

## Hu

What messages are produced by your initramfs when it tries to resume from the hibernation image?

----------

## kernelOfTruth

 *Hu wrote:*   

> What messages are produced by your initramfs when it tries to resume from the hibernation image?

 

from what I can tell:

nothing   :Question:   :Confused: 

what is it supposed to say - something like: "resuming ..." ?

sorry it has been several years now since the last time I tried and used hibernation (in the past it was suspend2 / tuxonice)

thanks Hu !

edit:

 *Quote:*   

> cat /usr/src/linux/.config | grep SUSPE
> 
> CONFIG_ARCH_SUSPEND_POSSIBLE=y
> 
> CONFIG_SUSPEND_NVS=y
> ...

 

 *Quote:*   

> cat /usr/src/linux/.config | grep HIBERN
> 
> CONFIG_ARCH_HIBERNATION_POSSIBLE=y
> 
> CONFIG_ARCH_HIBERNATION_HEADER=y
> ...

 

the disk-writing parts should all be properly set up (in /etc/hibernate and /etc/suspend.conf:

 *Quote:*   

> #snapshot device = /dev/snapshot
> 
> #resume device = /dev/disk/by-id/ata-SAMSUNG_HD203WI_S1UYJ1RZ514524-part8
> 
> resume device = /dev/mapper/GENTOO-SWAP
> ...

  )

so I don't really know why it's failing - or not even being started / resumed ...

----------

## kernelOfTruth

well I added

resume=swap:/dev/mapper/GENTOO-SWAP

on top of all that and got:

ls /dev/mapper/GENTOO-SWAP no such file or directory

(or something similar)

 :Shocked: 

I'm a little bit lost here

so I should call or add another command on grub.conf ?

many thanks in advance

----------

## kernelOfTruth

now I changed all relevant lines (in /etc/fstab, /etc/conf.d/dmcrypt, grub.conf, suspend.conf) to /dev/mapper/swap and outsourced the swap-partition to one of its own:

crypt_swap=/dev/sdd8 real_resume=/dev/mapper/swap resume=/dev/mapper/swap resume=swap:/dev/mapper/swap

but it still clearly says (!):

ls /dev/mapper/swap no such file or directory   :Shocked: 

at least that's now a progress / output I'm seeing   :Confused: 

----------

## kernelOfTruth

 sys-kernel/genkernel-3.4.9 - ls: : No such file or directory" message during boot 

Wow - that one's old  *Quote:*   

> Opened: 2008-01-19 20:49 

   :Shocked: 

BUT BUT BUT - I'm using:

genkernel-3.4.10.907   :Sad: 

----------

## Hu

I do not use genkernel initramfs, so I do not have its initscript handy.  Please post the section of its initscript which you believe should be triggering resume.  The resume program is often placed in /sbin in an initramfs, although it is located at /usr/lib/suspend/resume on the host filesystem.

----------

## kernelOfTruth

 *Hu wrote:*   

> I do not use genkernel initramfs, so I do not have its initscript handy.  Please post the section of its initscript which you believe should be triggering resume.  The resume program is often placed in /sbin in an initramfs, although it is located at /usr/lib/suspend/resume on the host filesystem.

 

I meanwhile re-emerged genkernel and started from scratch with a vanilla 2.6.35.7 kernel with latest tuxonice patched on top

and ...

it works !   :Very Happy: 

thanks anyway Hu  :Smile: 

I guess I'll stay away from the regular software-suspend in the near future ...

----------

## melinux

This still isn't resolved on my laptop.. I can't pm-hibernate with pm-utils-1.4.1 and I have enough swap space in my swap partition..

I have to keep using pm-utils-1.3.0-r2.

----------

## ippo

@ melinux

What about Your /etc/pm/config.d/defaults?

I can`t run hibernate on my laptop until i change my conf as below:

```

# cat /etc/pm/config.d/defaults 

##########################################################

# DO NOT EDIT THIS FILE!                                 #

#                                                        #

# Add files in /etc/pm/config.d/ instead!                #

##########################################################

# Default method to power down the system when hibernating.

# If commented out, the system will use the kernel default as a 

# default value.

#

# Check /sys/power/disk for valid values.  The default value

# will be surrounded by [square brackets].

 HIBERNATE_MODE="shutdown"

# Whether we need to post the video card when resuming from

# hibernate. You should not normally need to set this.  

# In the future pm-utils will get this setting from HAL.

#

# Valid values are "no" and "yes"

# HIBERNATE_RESUME_POST_VIDEO="no"

# The default sleep/wake system to use.  Valid values are:

#   kernel    The built-in kernel suspend/resume support.

#             Use this if nothing else is supported on your system.

#   uswsusp   If your system has support for the userspace

#             suspend programs (s2ram/s2disk/s2both), then use this.

#   tuxonice  If your system has support for tuxonice, use this.

#

# The system defaults to "kernel" if this is commented out.

 SLEEP_MODULE="kernel"

# These variables will be handled specially when we load files in 

# /etc/pm/config.d.

# Multiple declarations of these environment variables will result in 

# their contents being concatenated instead of being overwritten.

# If you need to unload any modules to suspend/resume, add them here.

# SUSPEND_MODULES=""

# If you want to keep hooks from running, add their names  here.

# HOOK_BLACKLIST=""

# If you want to unconditionally add parameters to the commandline,

# add them here.

# ADD_PARAMETERS=""

# If you want to ignore commandline parameters, add them here.

# DROP_PARAMETERS=""

# If you need to synchronize the system clock across a suspend/resume or

# hibernate/thaw cycle, set this variable.

# NEED_CLOCK_SYNC="true"

```

Now it works both - in console or gnome button.

Regards

----------

## melinux

I have no such file on my laptop...

I have a file called gentoo instead which contains a single line:

HOOK_BLACKLIST="01grub 55NetworkManager 90clock"

 *ippo wrote:*   

> @ melinux
> 
> What about Your /etc/pm/config.d/defaults?
> 
> I can`t run hibernate on my laptop until i change my conf as below:
> ...

 

----------

## melinux

I decided to try creating this defaults file and pm-hibernate worked this time...

thanks.. your post helped me solve the problem.

 *melinux wrote:*   

> I have no such file on my laptop...
> 
> I have a file called gentoo instead which contains a single line:
> 
> HOOK_BLACKLIST="01grub 55NetworkManager 90clock"
> ...

 

----------

