# system hibernates, but never resumes..

## gbr

Hi,

I just installed swsusp2 by emerging suspend2-sources.  I recompiled the kernel and changed lilo to have a resume2= line.

Now, when I hibernate, the system shuts down clean and fast (from a console, no X yet).

When I turn the system back on, I can't see it even trying to resume.  My swap partition is marked as bad (since it has an image in it), but the boot process never seemes to look for it.

I'm running the 2.6.12 suspend kernel, using genkernel to compile it.  Which means I have an initramfs, which I'm sure is the culprit.

Any help getting this going would be appreciated.

Gerald

----------

## gbr

anyone with some info for me?

----------

## Alighieri

I just figured this out. When you reboot from hibernating, go to the grub menu, select the correct kernel entry (whichever you were using when you hibernated) and hit 'e' for edit. Go to the initrd line and delete it (type 'd'). Go to the kernel line and hit 'e'. Replace "real_root=/dev/hdaX" with "resume2=swap:/dev/hdaY" where Y is your swap partition. If this works, edit your hibernate.conf file in the grub section. Uncomment the line about alternate suspended grub.conf. Make the alternate grub.conf based on your current one, but make the changes above (no initramfs and resume2=swap:/dev/hdaY).

Just noticed that you use lilo. Same idea. Just find a way to add the resume2= bit to your kernel args.

----------

## SKBo

There is also a way to keep the initramfs file created by genkernel.

As seen on this part of the Suspend2 howto site, the linuxrc script that is called must have an instruction to resume from a previous hibernation.

This is done by adding "echo > /proc/software_suspend/do_resume" to the /usr/share/genkernel/generic/linuxrc file.

Mine looks like this :

```
# Copyright 2003 Gentoo Technologies, Inc.

# Distributed under the GPL

. /etc/initrd.defaults

. /etc/initrd.scripts

splash() {

        return 0

}

[ -e /etc/initrd.splash ] && . /etc/initrd.splash

# Clean input/output

exec >${CONSOLE} <${CONSOLE} 2>&1

if [ "$$" != '1' ]

then

        echo '/linuxrc has to be run as the init process as the one'

        echo 'with a PID of 1. Try adding init="/linuxrc" to the'

        echo 'kernel command line or running "exec /linuxrc".'

        exit 1

fi

mount -o remount,rw /

mount -t proc proc /proc

# Software Suspend 2

echo > /proc/software_suspend/do_resume

(snip)

```

After the linuxrc file has been modified, you still have to recreate a new initramfs file by hand or using "genkernel initrd" with the options you specified the last time.

Now your initramfs should be used without changing anything on your grub.conf file (except if you didn't specified a swap partition in your kernel, you'll have to set the resume2 arg).

At boot, if a suspend signature is found, it will be used, otherwise it will boot normally.

----------

## Alighieri

Ah, perfect. Except for  *Quote:*   

> [Add this] 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. You have been warned.

  Shouldn't this come before you remount root? [Or are you remounting the ramfs root?)  Also, will this honor the "noresume" kernel arg?  I assume this becomes a noop when you did not suspend to disk, right?

----------

## SKBo

 *Alighieri wrote:*   

> Ah, perfect. Except for  *Quote:*   [Add this] 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. You have been warned.  Shouldn't this come before you remount root? [Or are you remounting the ramfs root?)  Also, will this honor the "noresume" kernel arg? Also, I assume this becomes a noop when you did not suspend to disk, right?

 

You are probably right, / should be mounted read-only, then proc, then software supend should be called depending on the noresume argument, then / should be remounted rw.

I knew I forgot something in my last message: it's a hack  :Razz: 

----------

