Make your own free website on
How to get Suspend to disk (Hibernate) to work on Debian Sarge

This has cost me a lot of sweat and was all together painful, so I want to share this with the community, so that YOU do not have to go through the same as me.

Get your copy of the Linux core
Get the kernelsource from
I used so all that is written here is concerning this release, but you should be able to get it working on any kernel with a few modifications.

Untar the source into /usr/src, so that it will form a dir like /usr/src/linux-

Home cooked is most delicious
Compile your own kernel. To do this, get first a .config file from somewhere and use it as a base, run make oldconfig and answer the questions to the new features that have been added since the .config file was done.
I did this, but failed miserably and after about 4 kernel compiles that left me without networking or some other annoyance like being unable to mount the root drive, I went from zero and created a new .config file.

Heating up the oven
cd into /usr/src/linux- and configure the kernel with make xconfig. There are a few other ways to do it, but I recommend this. Make sure that you are using a root shell from where you can use X (use gksu or such).
Now you might have noticed that we did not apply the patch yet. Yes, this is intentionally.
I don't know if it is me, but I endend up compiling the kernel about 9 times, before it finally just would boot normally, so forget about the patch for now. Let's just see if we can compile the kernel by itself, it is enough work as it is without patching it every time.

Little experiements can break your whole work
When configuring the kernel, don't get caught up in all the device driver details. Avoid experimental things: In my experience, when thoughts like "hmm, that sounds like a great new feature, let's try that out" pop into your mind, you risk wasting the whole configuration and compile. It can take one little thing and you will spend lots of time trying to find out where you set something on experimental. And remember one thing: Debian Sarge uses a initrd as standard. Software Suspend 2 does not like this, so avoid using an initrd.
To do this, make sure you got everything you need directly compiled into the kernel, NOT AS MODULES.
The things you absolutely need are: filesystem driver (ext2 / ext3 or whatever you are using) and IDE driver.
It took me forever to figure this out, and the system just won't mount the root filesystem, since it cannot access the drive after loading the kernel.

Kernel Module for NASA Nuclear Coffee Maker XR-54b
When configuring the kernel, there are millions of confusing similar looking devices. If in doubt, I recommend that you select MORE rather then less. Compiling the kernel takes quite some time, and if you forget one important thing, bang you will be doing it again, but after a nice reboot mind you.

You can always go back afterwards and throw out the things you don't need. I know I got a ton of things in my kernel right now that I surely don't need, but it is difficult to differentiate which ones are important and which ones are some old long forgotten IDE standard interface from the 80'ies.

When done, save your .config file and store it a save place. You might have spend some time configuring it from scratch, so preserve this work.

Enjoy using Debian for it
Now in Debian, you got a super cool and nice way to compile your kernel.

make-kpkg kernel_image --append_to_version mykernel1 --revision=dri.0

It is a "fire and forget" way to automatically create a .deb install package of the whole kernel as though you would get it over apt-get.

Right out of the oven
Once it terminates (might take some time, depending on your CPU), it will create a .deb image one dir higher than you currently are. Install that one with dpkg --install IMAGENAME and check your grub or lilo config. It should have added a new entry ot it.
Now reboot your system and check that everything is working correctly. If not, redo the kernel config and make sure you define all the parts that your system needs directly into the kernel (shown in the xconfig as Check marks instead of little round dots (which stands for module))
If your hardisk runs off a SCSI controller and it is not booting, you need to define SCSI support into the kernel, instead as modules as it might be.
In debian, these things are usually in the initrd, but we are not using that for this.

Once your system is running, I recommend wiping away the sourcecode from /usr/src/linux- and untar it again.
Remember to save your .config file or you can do the whole configuration again.
Without doing this, for some reason that I don't understand, make-kpkg refuses to recompile again.
There are ways to use make clean and make mrproper, but they did not work for me. Untaring the fresh source again is a fool proof way to start clean.

Let's plug in the software suspend 2
Get the patch from
The thing we are going to do is called Software Suspend 2. There are quite a few out there and it is very confusing, but this one works and it does some marvelous things like pretty automatic suspending into your swapspace.

Untar the patch and change into the dir /usr/src/linux-
From there execute the apply script from the patch. It will automatically patch the kernel source.

now run again make xconfig and check under the Power management option and see there the suspend2 entry that is new and made by the patching of the kernel.
Enable all options.

Now recompile the kernel again, this time with
make-kpkg kernel_image --append_to_version mykernel2 --revision=dri.1

make sure you use a different version and --append_to_version text, so it will not conflict with the current kernel.
make-kpkg is very nice though and will "talk" to you if something seems wrong to it.
I wish all programs would be that talkative ;-)

When the compile is done, install the new kernel like above and make sure you add the resume2= kernel parameter to your grub or lilo config. Mine looks like this:

kernel          /boot/vmlinuz- root=/dev/hda1 resume2=swap:/dev/hda2 ro

Why not use Swap
You can use a file for suspending, but I recommend using the swapspace. It is easier and worked for me.
Be careful to not boot into an old (non supend enabled) kernel after suspending, because your HD can get corrupted by it. (see for this warning the software suspend 2 homepage mentioned above)
To avoid this, make sure you got the resume2= in your kernel line AND make this kernel the default one. Otherwise resume will not work.

So, you are done... Reboot the system with the new kernel and if everything works as it should, you should be able to use the command hibernate to start the whole thing.

Rugged and virtually unbreakable it is
I have used software suspend 2 now for almost 1 year, every day on my work laptop and so far it has NOT EVEN FAILED ONCE, which is really remarkable. My thanks goes out to the fine people that wrote it. Good work!!!
I have tried to get to work hibernate on Windows XP properly and although it works in light workloads, when few programs are installed and running, it has randomly let me down for the purpose it was mainly written for (see rants and raves for more gripes on XP).
As so many times before, the saying that has established itself in my area holds true "if you want something to work consistently and dependably ALWAYS, you have to turn to Linux". Windows just seems to be a breeding ground for bad code, be it from Microsoft or otherwise.

Note: Software Suspend 2 even works in really hard cases, even when VMware is running. Everything gets frozen properly and woken up like it should.

2nd Note: I am currently testing Software Suspend 2 on Debian Etch (as of this writing: testing) and so far it works.

this document was created on:
15. May 2006
updated on:
6. Nov. 2006