TechRepublic : A ZDNet Tech Community

Linux and Open Source

Host: Jack Wallen
Contact

Recently, I had to write an article on Linux green computing. During the writing of that article I was sent on yet another quest to get some form of hibernate and or suspend working on a Linux laptop. This quest had me digging through nearly every configuration file and every package I could find in an attempt to get an off-brand laptop (Everex Zonbook) running Mandriva Spring 2008 to either suspend or hibernate. I was surprised at what I discovered and the results I came up with.

Let’s first chat about what I discovered. No I didn’t uncover the meaning of life, a cure for cancer, or proof that Linux will drastically lower TCO. What I did discover is that suspend and hibernate are two very different beasts and that suspend is still quite elusive in Linux while hibernate is not so challenging. How are they different? There are two different types of suspend: Suspend to RAM (suspend) and Suspend to Disk (hibernate.) Suspend to RAM is when you save the laptop state to RAM so that it can be quickly brought back. Suspend does continue to consume a small bit of power, so if your laptop is not plugged into a power source, eventually the suspend state could drain the battery.

Suspend to Disk (Hibernate) takes the saved state and stores it in your Linux swap partition. This method isn’t an “instant off/instant on” state, but it offers a few bonuses over Suspend. One bonus is that it uses zero power. Hibernate effectively shuts down your machine and, upon waking, brings the machine back to the exact state it was in when it was placed into hibernation. And because the state is saved to the hard disk, it is a bit safer than suspend. On the con side of the fence, hibernate does take far more time to put to sleep and wake up (although not as much time as it would to shutdown/boot.)

The good news and the bad news: The good news is that Linux can do hibernate fairly well. AND there are even GUIs to help you configure hibernate. The bad news is that Linux is a ways away from any sort of reliable suspend.

Let’s look at one application that allows you to safely hibernate your Linux laptop: klaptop_acip_helper. This command is part of the kdeutils_klaptop package and is run by simply entering the command klaptop_acpi_helper –hibernate. When you run this, the current state is saved, placed in your swap file, and then the laptop is placed in hibernation. To bring the laptop back up, you simply hit the power button.

Of course having to hibernate a laptop from the command line isn’t much good to the average user. To make this easier you can configure a lot of options in the Klaptop system tray applet. In this applet you can configure everything from Power Control, battery options, warning events, and button events. One of the handiest configurations is the button events. Here, you can configure your laptop to go into hibernate upon closing the lid.

Of course there are configurations that must be taken care of that can not be done via the applet. If you look in the file /etc/suspend.conf you will see the following:

snapshot device = /dev/snapshot
resume device =

#image size = 350000000
#suspend loglevel = 2
#compute checksum = y

#compress = y
#encrypt = y
#early writeout = y
splash = y

There are two things you need to do. First you need to replace

with the actual path to your swap file. In my case it was /dev/sda5. The second thing do to is to uncomment compress = y. Once you have taken care of these edits, save the file, and close the file.

Now close the lid on your laptop. After it is closed for a moment, open it back up and you should see some text indicating how much of the state has been saved. Once the state reaches 100% the laptop will power off. When you reboot the machine it will seem as if it is just going through the boot process. But shortly after you press the power button the progress bar will zip through the process and you will find yourself back where you were when you shut the lid.

Would getting Hibernate to work encourage you to instal Linux on your laptop?

View Results

Loading ... Loading ...

Is this a perfect solution? No. But it does at least offer a means to save your battery life and give you a laptop-feature in Linux that all Windows laptop users enjoy.

I hope some day to see the Suspend to RAM function actually work. This would remove one of the biggest hurdles for Linux adoption in the laptop market. Give this application a try and report back here so we know the various laptop models it supports.

Jack Wallen was a key player in the introduction of Linux to the original Techrepublic. Beginning with Red Hat 4.2 and a mighty soap box, Jack had found his escape from Windows. It was around Red Hat 6.0 that Jack landed in the hallowed halls of Techrepublic. Read his full bio and profile.

Print/View all Posts Comments on this blog

Huh? tracy anne | 10/05/08
some hardware isn't that easy jlwallen@... | 10/05/08
I must be lucky indeed tracy anne | 10/05/08
yes you are! pgit | 10/09/08
RE: Hibernating a Linux Laptop...FINALLY! rickenbacherus@... | 10/05/08
RE: Hibernating a Linux Laptop...FINALLY! blah32@... | 10/06/08
Nope parnote@... | 12/30/08
RE: Hibernating a Linux Laptop...FINALLY! JimMcDish@... | 10/06/08
RE: Hibernating a Linux Laptop...FINALLY! _carlleigh_ | 10/06/08
RE: Hibernating a Linux Laptop...FINALLY! rt@... | 10/06/08
RE: Hibernating a Linux Laptop...FINALLY! abcddd@... | 10/06/08
RE: Hibernating a Linux Laptop...FINALLY! ttdlx1989@... | 10/06/08
RE: Hibernating a Linux Laptop...FINALLY! markinct | 10/07/08
That's critical??? kingttx | 10/07/08
By critical I meant... markinct | 10/08/08
Curious shardeth | 10/07/08
Support vendors supporting Linux alvarocervantes@... | 10/07/08
Curiouser and curiouser... RipVan | 10/09/08
9 Times Out of 10 rickk@... | 10/09/08
RE: Hibernating a Linux Laptop...FINALLY! eck0 | 10/07/08
RE: Hibernating a Linux Laptop...FINALLY! aroc | 10/07/08
what about dual boots chris@... | 10/08/08
It should be OS independent Neon Samurai | 10/08/08
swap pgit | 10/09/08
I like when I learn stuff Neon Samurai | 10/09/08
RE: Hibernating a Linux Laptop...FINALLY! hisham_tj@... | 10/09/08
Seems to work OK in Ubuntu 8.04 heres_johnny | 10/09/08
Hibernate/Suspend under Ubuntu markinct | 10/13/08
Works on Mandriva potter67 | 12/30/08
RE: Hibernating a Linux Laptop...FINALLY! Gaius_Maximus | 01/09/09
RE: Hibernating a Linux Laptop...FINALLY! chrisspen@... | 01/29/09

What do you think?

White Papers, Webcasts, and Downloads

Recent Entries

TR on Twitter

Archives

TechRepublic Blogs



Recovering Windows Clients
Part of your job is to make sure that your users' PCs are healthy and reliable. Learn how to use tools such as the Windows 2000 Recovery Console and Windows XP Pro's Automated System Recovery to deal with system failures.
Buy Now
Creating and Configuring Home Networks
Learn how to determine the best type of Internet connection for your needs, how to select a reliable provider, and how to set up your network for maximum efficiency, whether wired or wireless.
Buy Now

SmartPlanet

Click Here