AT LAST: laptop sleep on Linux

At last! After years of fighting with Linux and laptop sleep (suspend-to-RAM), I finally got it working on this LinuxCertified LC2430 laptop. I have tried many times in the past to make it work, but it wouldn’t wake up properly. I decided to try make it work for a last time, as Linux.com posted a nice guide recently (written by a fellow Greek). I followed the instructions to the letter, but again, the laptop would go to sleep but wouldn’t wake up properly…

Thankfully, the solution was in the comments! A guy said that in order sleep to work with his Radeon, he had to pass a kernel parameter during boot time (on Lilo or Grub): acpi_sleep=s3_bios. My laptop also uses a Radeon (9200 — I use the r200 xorg driver) and after I added this parameter and rebooted, it worked!!!

I have since made some changes to the article’s suspend.sh file in order to work better with my Linux distribution, Arch Linux (I put network to sleep and I use vbestate to save the graphics card’s state instead of the Temp file the author of the article used). If you are using Arch, just use the instructions on the article linked above (for suspend-to-ram, not hibernate) and then use my suspend.sh instead of the article’s. All the tools needed for my modified script (hdparm & vbetool) are part of the main Arch repositories and are easily installable via ‘pacman’. You can choose to unload more kernel modules (and then load them again after wake-up in the script) so you save even more battery (Linux is not as good as Windows/OSX in saving enough battery while on sleep).

#!/bin/sh
/etc/rc.d/network stop
/usr/sbin/vbetool vbestate save > /etc/acpi/vbestate
chvt 1
sync
hdparm -y /dev/hda
echo -n mem > /sys/power/state
hdparm -a1024 -c3 -d1 -m16 /dev/hda
/sbin/hwclock --hctosys
/bin/cat /etc/acpi/vbestate | /usr/sbin/vbetool vbestate restore
chvt 7
/etc/rc.d/network start

I must note though that the system is kinda slower when it wakes up. Wake up from sleep on Linux is known to create weird problems. I might need to unload a few modules manually and then reload them, just to make sure…

Post a comment »

what's wrong with mint? wrote on June 9th, 2006 at 6:04 AM PST:

Eugenia, check out Fedora’s pm-utils. I’m sure you’re no fan, but they’ve done a nice job of getting this to “just work” over different video cards etc.


This is the admin speaking...
Eugenia wrote on June 9th, 2006 at 6:58 AM PST:

As I wrote in my review of FC5 on OSNews a couple of months ago, their touted ACPI implementation did NOT work with my laptop. I am sure the problem was just the missing kernel parameter. They have to find a way to make ACPI itself use these parameters automatically, when needed. Otherwise, 99.9% of the users who can’t get sleep working on their laptop they will never figure out what’s wrong…


what's wrong with mint? wrote on June 10th, 2006 at 2:52 AM PST:

Fair enough regarding the kernel-side ACPI stuff, detecting automatically whether s3_bios etc. is needed would be great.

But my point was that their user-space stuff is exceptional in already handling everything you scripted above and covering more cases. I had my own scripts like yours for a year or so and now I can throw them away.

P.S., not to harp on the mint thing, but I just stuffed two handfuls from my garden into a liter bottle of vodka. In about a month, this will be quite enjoyable.


This is the admin speaking...
Eugenia wrote on June 10th, 2006 at 3:04 AM PST:

I checked it out, and their sample hooks only work on Fedora, AFAIK. They stop and start services that don’t exist on Arch Linux.

As for mint, I am ok with it. I don’t really hate it or anything. I just thought I write something funny on the mirrored comic pic.


Francis wrote on June 13th, 2006 at 1:46 AM PST:

I had Ubuntu 5.04 installed on a clamshell iBook and sleep sometimes worked, but most of the times I had to make a hard reset to the machine. A few mmonths ago I finally had enough money to buy a 1st generation titanium powerbook g4@400mhz. Yes, I’m poor and that’s not gonna change in the forseable future :-) Anyway, the same version of Ubuntu works wonderfully well on the titanium out of the box, without any kind of tweaking! I’m a happy camper :-)


Comments are closed as this blog post is now archived.

Lines, paragraphs break automatically. HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

The URI to TrackBack this blog entry is this. And here is the RSS 2.0 for comments on this post.