# hibernate not working

## kueitao

Hi all,

When I suspend to disk with "hibernate" the machine seems to do that properly, but when I want to resume I am not given the machine status I had before hibernating. Instead I get a usual boot sequence. It seems like the operating system can't see the machine having a valid swap partion from which to resume.

To the contrary "hibernate-ram" seems to work properly: the machine is shutdown and afterwards it is resumed normally.

Any idea either to better debug this behaviour or to solve the issue?

Thanks in advance to anyone who will reply.

fabio

----------

## rh1

Maybe you need to add resume to kernel line in grub.conf?

```
kernel kernel-2.6.blah <whatever other options you use> resume=/dev/<swap_partition>
```

----------

## Hu

What kernel version are you using?  Which hibernation method are you using?  If you are using uswsusp, what messages does the initramfs resume print when it rejects your hibernation image?

----------

## kueitao

 *rh1 wrote:*   

> Maybe you need to add resume to kernel line in grub.conf?
> 
> ```
> kernel kernel-2.6.blah <whatever other options you use> resume=/dev/<swap_partition>
> ```
> ...

 

In grub.conf I have:

title Gentoo Linux x86_64

root (hd0,0)

kernel /boot/vmlinuz root=/dev/sda3 ro vga=0x365 video=vesafb:mtrr:3,ywrap resume=swap:/dev/sda7

Thanks,

fabio

----------

## kueitao

 *Hu wrote:*   

> What kernel version are you using?  Which hibernation method are you using?  If you are using uswsusp, what messages does the initramfs resume print when it rejects your hibernation image?

 

# uname -a

Linux host11 2.6.35-gentoo-r10-101010 #1 SMP PREEMPT Sat Oct 23 14:42:47 CEST 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz GenuineIntel GNU/Linux

I don't use initramfs. I'm not sure to understand the question about which hibernation method I am using. Where can I check that?

Thanks,

fabio

----------

## Hu

Since you are using sys-kernel/gentoo-sources, we can rule out TuxOnIce based hibernation.  To use that, you would be on sys-kernel/tuxonice-sources or you would have manually patched the kernel.  Manual patching is involved enough that you would know if you had done that.  Most likely, you are using uswsusp.  What is the output of emerge --pretend --verbose sys-power/suspend; find /etc/hibernate/ -type f -print0 | xargs -0 grep -Hn '^[^#]'?

If you are using uswsusp as I suspect, then you must trigger a resume before mounting root.  This is most easily accomplished using an initramfs.  You can build the initramfs into the kernel or load it separately.

----------

## kueitao

 *Hu wrote:*   

> Since you are using sys-kernel/gentoo-sources, we can rule out TuxOnIce based hibernation.  To use that, you would be on sys-kernel/tuxonice-sources or you would have manually patched the kernel.  Manual patching is involved enough that you would know if you had done that.  Most likely, you are using uswsusp.  What is the output of emerge --pretend --verbose sys-power/suspend; find /etc/hibernate/ -type f -print0 | xargs -0 grep -Hn '^[^#]'?
> 
> If you are using uswsusp as I suspect, then you must trigger a resume before mounting root.  This is most easily accomplished using an initramfs.  You can build the initramfs into the kernel or load it separately.

 

host11 ~ # emerge --pretend --verbose sys-power/suspend

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  N    ] dev-libs/lzo-2.03  USE="examples" 612 kB

[ebuild  N    ] sys-power/suspend-0.9_pre0  USE="crypt -fbsplash" 720 kB

Total: 2 packages (2 new), Size of downloads: 1,331 kB

host11 ~ # find /etc/hibernate/ -type f -print0 | xargs -0 grep -Hn '^[^#]'

/etc/hibernate/blacklisted-modules:25:acx100

/etc/hibernate/blacklisted-modules:26:acx_pci

/etc/hibernate/blacklisted-modules:27:hsfmodem

/etc/hibernate/blacklisted-modules:28:prism54

/etc/hibernate/blacklisted-modules:30:bcm4400           2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:31:emu10k1           2.4.0   2.4.99  2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:32:forcedeth 2.4.0   2.4.99  2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:33:@ipw2100  0.0     1.0.2

/etc/hibernate/blacklisted-modules:34:@ipw2200  0.0     0.20

/etc/hibernate/blacklisted-modules:35:natsemi           2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:36:psmouse           2.6.0   2.6.19

/etc/hibernate/blacklisted-modules:37:rt2400            2.4.0   2.4.99  2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:38:ehci_hcd  2.6.0   2.6.14

/etc/hibernate/blacklisted-modules:39:ohci_hcd  2.6.0   2.6.14

/etc/hibernate/blacklisted-modules:40:uhci_hcd  2.6.0   2.6.14

/etc/hibernate/blacklisted-modules:41:ehci-hcd  2.4.0   2.4.99

/etc/hibernate/blacklisted-modules:42:usb-ohci  2.4.0   2.4.99

/etc/hibernate/blacklisted-modules:43:usb-uhci  2.4.0   2.4.99

/etc/hibernate/blacklisted-modules:44:snd_ens1370       2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:45:snd_ens1371       2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:46:snd_maestro3      2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:47:@snd_bt_sco       0.0     1.18

/etc/hibernate/blacklisted-modules:48:en1370            2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:49:en1371            2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:50:via_agp           2.6.0   2.6.8

/etc/hibernate/blacklisted-modules:51:via_rhine 2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:52:i8042             2.6.10  2.6.99

/etc/hibernate/blacklisted-modules:53:intel_mch_agp     2.6.0   2.6.99

/etc/hibernate/blacklisted-modules:54:rt2500            2.6.0   2.6.14

/etc/hibernate/blacklisted-modules:56:button            2.6.9   2.6.22

/etc/hibernate/blacklisted-modules:57:speedstep_smi     2.6.12  2.6.99

/etc/hibernate/blacklisted-modules:59:@ndiswrapper    0.10    0.11

/etc/hibernate/blacklisted-modules:61:nvidia            0.0     2.6.25

/etc/hibernate/blacklisted-modules:64:ath_pci

/etc/hibernate/blacklisted-modules:67:ipw3945

/etc/hibernate/blacklisted-modules:70:iwl3945           2.6.0   2.6.27

/etc/hibernate/blacklisted-modules:71:mac80211  2.6.0   2.6.27

/etc/hibernate/blacklisted-modules:72:sky2

/etc/hibernate/blacklisted-modules:76:uvcvideo

/etc/hibernate/blacklisted-modules:79:snd_ice1712

/etc/hibernate/blacklisted-modules:82:firewire-core

/etc/hibernate/blacklisted-modules:83:firewire-sbp2

/etc/hibernate/blacklisted-modules:84:firewire-ohci

/etc/hibernate/common.conf:10:Verbosity 0

/etc/hibernate/common.conf:11:LogFile /var/log/hibernate.log

/etc/hibernate/common.conf:12:LogVerbosity 1

/etc/hibernate/common.conf:17:Distribution gentoo

/etc/hibernate/common.conf:35:SaveClock restore-only

/etc/hibernate/common.conf:96:UnloadBlacklistedModules yes

/etc/hibernate/common.conf:97:LoadModules auto

/etc/hibernate/common.conf:132:SwitchToTextMode yes

/etc/hibernate/disk.conf:7:TryMethod ususpend-disk.conf

/etc/hibernate/disk.conf:8:TryMethod sysfs-disk.conf

/etc/hibernate/hibernate.conf:14:TryMethod disk.conf

/etc/hibernate/hibernate.conf:15:TryMethod ram.conf

/etc/hibernate/ram.conf:11:TryMethod ususpend-ram.conf

/etc/hibernate/ram.conf:12:TryMethod sysfs-ram.conf

/etc/hibernate/sysfs-disk.conf:7:UseSysfsPowerState disk

/etc/hibernate/sysfs-disk.conf:9:Include common.conf

/etc/hibernate/sysfs-ram.conf:7:UseSysfsPowerState mem

/etc/hibernate/sysfs-ram.conf:9:Include common.conf

/etc/hibernate/tuxonice.conf:12:UseTuxOnIce yes

/etc/hibernate/tuxonice.conf:13:Reboot no

/etc/hibernate/tuxonice.conf:14:EnableEscape yes

/etc/hibernate/tuxonice.conf:15:DefaultConsoleLevel 1

/etc/hibernate/tuxonice.conf:16:Compressor lzf

/etc/hibernate/tuxonice.conf:17:Encryptor none

/etc/hibernate/tuxonice.conf:43:FullSpeedCPU yes

/etc/hibernate/tuxonice.conf:45:Include common.conf

/etc/hibernate/ususpend-both.conf:10:USuspendMethod both

/etc/hibernate/ususpend-both.conf:12:Include common.conf

/etc/hibernate/ususpend-disk.conf:10:USuspendMethod disk

/etc/hibernate/ususpend-disk.conf:12:Include common.conf

/etc/hibernate/ususpend-ram.conf:10:USuspendMethod ram

/etc/hibernate/ususpend-ram.conf:41:Include common.conf

I don't know anything about initramfs. If you think I need it, please, point me to some documentation that could help for this issue of "triggering a resume before mounting root".

Thanks.

fabio

----------

## rh1

You can look here for help with making an initramfs. 

http://en.gentoo-wiki.com/wiki/Initramfs

It actually pretty easy to do. Just do yourself a favor, you want to copy the device nodes like it states (null,console,tty) but don't rely on just copying "/dev/sda*" for your harddrives, use the section on mdev.

Not sure what your resume command should be, i use tux, but it should go after mounting /proc and /sys but before mounting root.

This might also help you:

http://en.gentoo-wiki.com/wiki/Userspace_software_suspend

----------

## kueitao

 *rh1 wrote:*   

> You can look here for help with making an initramfs. 
> 
> http://en.gentoo-wiki.com/wiki/Initramfs
> 
> It actually pretty easy to do. Just do yourself a favor, you want to copy the device nodes like it states (null,console,tty) but don't rely on just copying "/dev/sda*" for your harddrives, use the section on mdev.
> ...

 

Ok. I have done everything described in these documents but the init script... Can someone help? My root partition is on /dev/sda3 and swap is on /dev/sda7.

Thanks in advance.

fabio

----------

## Hu

It looks like you never configured the hibernate script, so it is running down all the possibilities until it finds one that works.  You do not have sys-power/suspend installed, so you are not using s2disk like I expected.  That in turn means that the resume command from sys-power/suspend is not the right thing to restore the system.  I suppose you are using the sysfs based suspend method.  I have never tried to restore a kernel from that mode, but based on the documentation, it looks like you should echo the major and minor numbers of your resume device into /sys/power/resume.  See the example script in Documentation/power/swsusp-dmcrypt.txt.

----------

