Software Suspend support on Dell Latitude D500 w/ Debian kernel v2.6.9

Posted by ryan
at 3:57 PM on Monday, January 17, 2005



Getting suspend functionality was probably the most challenging part of setting up my laptop so far. You’d be surprised how annoying it is to have to shutdown everytime you want to close your laptop lid and take it on a 10 minute journey home. A big thanks goes out to Nigel Cunningham who actually responded to my direct email when the mailing lists were down (Nigel is one of the software suspend developers, and I found his name while searching for an error message that I was receiving – his name was on the commit for the file with that error message. Despite his friendly help, I’m sure he curses Google daily.) So here are the steps I took to get software suspend working on my laptop:

Make sure you have the kernel sources, headers and initrd-tools installed:

  • apt-get install kernel-source-2.6.9 kernel-headers-2.6.9-x-686 initrd-tools
  • cd /usr/src
  • (If “linux” already exists): unlink linux
  • ln -s kernel-source-2.6.9 linux

Patch the kernel with software suspend support (http://softwaresuspend.berlios.de/HOWTO-2.html#ss2.3)

Now that the patch has been applied, you need to download the debian specific script as outlined here: http://swsusp.sourceforge.net/wiki/DebianInitrd

  • copy the script from the above URL into a new file called ”/etc/mkinitrd/scripts/swsusp2”

Compile your kernel and make the kernel and initrd images:

  • cd /usr/src/linux
  • make-kpkg clean
  • make-kpkg —append-to-version -swsuspend—config menuconfig—initrd kernel_image kernel_headers

In the kernel menu config make sure of the following selections (I only had success building them as modules (M))

  • Power management options —> Software Suspend 2 --> Software Suspend 2
  • Swap Writer
  • LZF image compression
  • Text mode console support

Install your kernel

  • dpkg -i kernel-headers-2.6.9-swsuspend.deb kernel-image-2.6.9-swsuspend.deb

After installing your kernel, you will need to edit your grub configuration for your new kernel to include the swap space that software suspend uses to suspend to. While there’s a blurb on the software suspend wiki where you downloaded the swsusp2 script that the script made you not need this parameter, I still had to include it:

  • cd /boot/grub/
  • nano (or your fav editor) menu.lst
  • Look for the entry representing your new kernel (this should be the first entry) and add “resume2=swap:/dev/hda3” to the “kernel” line. Mine looks like this:

    “kernel /vmlinuz-2.6.9-mppe-swsuspend root=/dev/hda6 resume2=swap:/dev/hda3”

    The ”/dev/hda3” is your swap space device. To find out what yours is run this command: “cat /etc/fstab | grep swap”.

Now you need to install the hibernate script that actually invokes the suspend functionality. It’s available as a debian package “hibernate”, but I downloaded and installed from the package available on the software suspend site. If any steps differ here it’s probably b/c of that:

The default hibernate configuration didn’t work for me out of the box b/c while the software suspend script you included earlier in /etc/mkinitrd/scripts/ loads the necessary suspend modules, it also unloads them – serving just to make sure the proper modules are available. The hibernate support needs these modules loaded to function so it has to re-load them when hibernate is invoked. Fortunately, it’s an easy update the hibernate.conf file that will make this happen:

  • cd /etc/hibernate
  • nano (or your fav editor) hibernate.conf
  • Uncomment the line starting with “LoadSuspendModules”
  • Add “suspend_core” to the list of modules. My line looks like this:

    “LoadSuspendModules suspend_core suspend_swap suspend_lzf suspend_text”

At this point, all should be ready for a reboot into your new kernel. Go ahead and reboot and select your new kernel from the list (again, it should be the first in the list). If everything goes well, you should see the following scroll by (also retrievable once logged in w/ “dmesg”:

Software Suspend Core.
Software Suspend text mode support loaded.
Software Suspend LZF Compression Driver registered.
Software Suspend Swap Writer registered.
Looking for first block of swap header at block 0.
Setting logical block size of resume device to 4096.
Software Suspend 2.1.5: Swap space signature found.
Software Suspend 2.1.5: Suspending enabled.
Software Suspend 2.1.5: This is normal swap space.
Software Suspend Swap Writer unloading.
Software Suspend 2.1.5: No writers have been registered.
Software Suspend LZF Compression Driver unloading.
Software Suspend text mode support unloading.
Software Suspend Core unloading.

If you see something like: “BIG FAT WARNING!!!”, then a double check that the “resume2=swap:/dev/hdx” option on the kernel boot line (in /boot/grub/menu.lst) is there and points to your swap space device. If you don’t see any errors, and do see the Software Suspend module messages on startup, then things are looking pretty good for you.

After your reboot, go ahead and login as root. Run the “hibernate” command and your machine should switch to text mode where it shows a progress bar saving your memory to disk. Press the power on button to startup again, choosing the same kernel you were in when you suspended, and your applications etc… should be loaded back into memory – including X.

This process was frought with many errors and messages that I didn’t record while I was figuring them out, so if you run into an error, let me know (using the comments), there’s a good chance I’ve seen it before. Good luck!

When following this guide on my work D600 I ran across the following error. After doing a complete build etc… and booting into the new kernel I was getting this error:

=== Software Suspend ===

BIG FAT WARNING!! Can't check whether to resume. Suspend's core module isn't loaded.

If you continue booting, note that any image WILL NOT BE REMOVED.
Suspend is unable to do so because the appropriate modules aren't
loaded. You should manually remove the image to avoid any
possibility of corrupting your filesystem(s) later.
Press SPACE to reboot or C to continue booting with this kernel

After scratching my head for awhile I noticed that when I copied and pasted the script from http://download.berlios.de/softwaresuspend/software-suspend-2.1.5-for-2.6.9.tar.bz2 to ”/etc/mkinitrd/scripts/swsusp2” I didn’t change the file to be executable. So…, I restarted from that point and did a “chmod +x /etc/mkinitrd/scripts/swsusp2”. After recompiling again, etc…, the reboot still had the same problem. Crap! I ended up just copying and pasting my vmlinuz and initrd image from my working D500 laptop onto the laptop where I was having these issues (my work D600). Luckily, that worked! I still think that the swsusp2 script wasn’t getting picked up when the initrd image was built (I think this b/c after one of the faulty boots, there was no /proc/software_suspend dir – which the swsusp2 initrd script creates?) For those that think it might be useful, I’ve uploaded both my working kernel and my image – you may only need the image?. (Note: this kernel and image include both mppe support and swsuspend2 support)

Comments

Leave a response