Author Topic: Laptops: Suspend, Hibernate and DSDT  (Read 46275 times)

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Laptops: Suspend, Hibernate and DSDT
« on: March 06, 2007, 07:49:54 AM »
UPDATE: If "Suspend" works for you from the KLaptop icon but not from the "Sleep" button, you may wish to look ahead to reply #27 on page two of this thread.

IMPORTANT EDIT: From the final release of PCLinuxOS 2007, you will not need to edit Grub to make Hibernate (aka Suspend to Disk) work, the scripts will add the "resume=/dev/{swap partition}" for you. You should however read on if you are having difficulties with Suspend (aka Suspend to RAM).

This HowTo is about setting up Hibernate and Suspend on your laptop. It goes on to explain how to try DSDT tables if acpi functions are not working properly. Please read the rest of this section before you start, as Hibernate, the easiest to get working, involves a manual change to a system file.

Before you start: You should make a copy of your Grub file (/boot/grub/menu.lst) and familiarise yourself with how to put it back using the Live CD if anything goes wrong. I cannot take responsibility for an unbootable system.

This is how I suggest you go about it. Follow this as a kind of exercise, if you can't, you don't want to be fiddling with important system files. You'll need your live CD.

Boot up from your Hard Disk.

Run "File Manager Super User Mode"

Navigate to /boot/grub

Right click on the file menu.lst

From the menu, select Copy.

Now click on some empty space in the same window, right click and from the menu, select Paste.

As there is already a file called menu.lst it will prompt you for another name. Change it to menu.lst.working

You have now created a working copy. Reboot to the live CD.

Login as root, and start "Home". On the left, select the Red Flag logo. Then Storage Media. There should be a list of your Hard Drive partitions under the words Storage Media and the icons on the right. Under Storage Media select each icon in turn. As it mounts, you will see a list of folders and files on the right. You need to locate the folder with your menu.lst.working file in.

OK now is what you do to recover the original menu.lst. If you've got this far just read the rest, don't actually go it unless you need to. You rename the one that's there (ie to menu.lst.borked) by right clicking on it and selecting Rename from the menu. You then Right Click on menu.lst.working and do the Copy and Paste thing again, this time renaming the copy to menu.lst

If you can follow this and know where you're going, you can hand edit /boot/grub/menu.lst and know how to recover your system should you break it.

I really can take no responsibility if you cannot. You will have to re-install if that's the case.

Make the backup copy of menu.lst to menu.lst.working before attempting what follows in the next two messages.
« Last Edit: June 28, 2007, 05:05:08 AM by davecs »
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #1 on: March 06, 2007, 08:03:29 AM »
CHANGING YOUR GRUB FILE

For Hibernate (Suspend to Disk) you must edit your GRUB file and tell GRUB where your swap partition is. For Suspend (to RAM), it is often the case that booting up in plain text mode rather than Framebuffer can make all the difference whether you can recover or not.

1. First go to PCLOS Control Centre > Mount Points > Hard Disk Partitions. Locate your swap partition. If the colours are working, it's green. Click on it. In the right-side panel, there is an entry Device: followed by something starting hd or sd. Write this down, you'll need it. I will refer to it as hdan in future (even though the h might be an s). You can now close the control centre.

2. From the PC Start Menu, select Run, and in the box that comes up type:

kdesu 'kwrite /boot/grub/menu.lst'

You will be asked for your root password before proceeding to the file to be edited.

On the first line that starts "kernel", add at the end: resume=/dev/hdan. (the last bit here is what you wrote down earlier)

Remove your nice Framebuffer bootup. If you intend to try Suspend (to RAM), sometimes that makes all the difference. If you remove the entries that say "splash=silent vga=788", this will give you a plain text bootup. Not pretty, but once booted up you still get your graphics, this is only a change to the starup process. You may already have a second entry where these items are already removed. In that case, just add the resume=/dev/hdan to the kernel line in that as well, and use this entry to boot up next time.

3. Reboot, using your "no framebuffer" entry if you have both.

SETTING UP KLAPTOP

4. Check whether you have the KLaptop icon in your system tray, if not, run KDE Control Centre > Power Control > Laptop Battery and tick Show Battery Monitor. On clicking OK the KLaptop icon should appear in your system tray. If it does not, or there is a message reporting a "partial" ACPI implementation, it's possible you will need to install an alternate DSDT. (Huh? What's that? Here's a clue http://gaugusch.at/kernel.shtml .) That's the subject of the next post.

5. Right click on the KLaptop icon and select Configure. On the last tab ACPI options, you get the option to allow Suspend and Hibernate. You will need root access to allow your "user" to use them. And then you can tick Suspend and Hibernate. Click OK and exit.

6. Right click on the KLaptop icon and select Hibernate. Your computer will close down. Start it up again. At grub select the same entry you did last time, that's important. You will get a shorter bootup straight to your desktop.

7. Right click on the KLaptop icon and select Suspend. Your computer will partially close down. Pressing any key should fetch it back in seconds.

Do not use Beryl at any stage here. Recovery from Suspend/Hibernate can be affected by Beryl/Compiz. Make sure it's working first before complicating issues!

If they both worked, that's it. Go back into KLaptop configuration and set up your power button, lid down, battery critical stuff, and enjoy. If not, or if it's reporting that it cannot sort out your battery or your power problems, you may need to try a DSDT table.


« Last Edit: March 06, 2007, 10:05:40 AM by davecs »
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #2 on: March 06, 2007, 09:40:01 AM »
NB None of what follows has any effect unless you have kernel 2.6.18.6-tex1 or later. So 0.93a is a no-no, and 2007TR1/TR2 need a kernel upgrade before you go any further. Also if your lappy uses APM rather than ACPI this has no effect.

ADDING A DSDT FILE

In many cases, the firmware on your laptop was tested for windows, but not Linux, and that's why these things don't always work properly. There is a solution, however. Until recently it required a kernel patch, and the patch was different for every laptop. This is, of course, out of the scope of a distro like PCLinuxOS. Now there is a way to avoid that. ocilent1 has added a change to the kernel which enables the "patch" to be applied through the "initial ramdisk" initrd.img. This is something that you can do yourself.

The thing causing the problem is called a Differentiated System Description Table, or DSDT. You can now get an alternate DSDT on the net, and use it on your laptop.

You need to compile it using an intel compiler called "iasl". Go to synaptic and install a program called iasl.

Then you need to find a ".asl" file for your lappy here:

http://acpi.sourceforge.net/dsdt/view.php

You will find different ones for your laptop. Sorry, each laptop may have been issued with slight internal modifications. You may have to try more than one before one works. You may find none work. Sorry if you waste your time. It may help if you go into your BIOS setup screen on bootup and make a note of the firmware revision numbers etc. Download the file to your desktop. It's actually compressed, so if you click on it, you will open "Ark". Drag the asl file out of the archive onto your desktop and select Copy Here. You need to open a terminal, and enter the following commands, (ENTER after each line):

cd Desktop
iasl file-name.asl

Where the file-name.asl is the actual file name of your asl file. Before going further, ensure that iasl reported no errors.

You end up with a new file called DSDT.aml which is for your particular laptop. Now continue:
 
su
(root password)
cp DSDT.aml /boot
cd /boot

Next line only needed second and subsequent time around:
rm initrd2.img

mkinitrd --dsdt=DSDT.aml initrd2.img `uname -r`

Note that last line the quotes are "grave accents" aka "reverse ticks". That is crucial. You now have a second initrd.img called initrd2.img. You can now add this to GRUB. Don't worry we will keep the original image available for emergency.

Still in your terminal, type in:

kwrite /boot/grub/menu.lst

(that's a small L not a number 1)

Use copy and paste to duplicate the first 3-line section that starts with "title". Change the title of the second entry to read "Linux-DSDT", the BOOT_IMAGE entry also to Linux-DSDT, and the initrd line to end initrd2.img instead of initrd.img. Also, in this second section only, delete any "acpi=off or acpi=ht" entries, as the whole point here is to get acpi on! Save. Now you have an extra entry in your GRUB menu which is for your amended initial read image.

OK you can now reboot, and test the new image. If the computer boots, there is a fair chance that everything that didn't work, will. If it gets stuck, just reboot using the original entry, and try again with another asl file. Same if it boots but still not working properly and you want to try another DSDT file. The only difference is that you need to delete the initrd2.img file before mkinitrd will create another.

If it does work, you will have to repeat from the "su" line whenever you load a new kernel, except that you can omit the line starting "cp". Although at every kernel update I would first test to see whether everything works without all DSDT stuff, you never know.

I learnt all this but didn't need it for myself, as changes in the Suspend system worked on my lappy. I would like to know of any success stories, however.

« Last Edit: March 06, 2007, 10:41:39 AM by davecs »
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Scotty Dog

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #3 on: March 11, 2007, 08:48:11 PM »
This worked flawlessly! Thank you! The only issue I am seeing is that my Linksys (acx111) wireless nic is dropped and will not refresh after I did the hibernate and suspend test. I had to reboot to restore internet connectivity. Also, I was not able to turn off Beryl first, as it told me it needed to download and install something before I could disable it, but then barfed on the install. So, I tried it with Beryl enabled, and it still worked ok. Great How To!

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #4 on: March 13, 2007, 06:15:09 PM »
This worked flawlessly! Thank you! The only issue I am seeing is that my Linksys (acx111) wireless nic is dropped and will not refresh after I did the hibernate and suspend test. I had to reboot to restore internet connectivity. Also, I was not able to turn off Beryl first, as it told me it needed to download and install something before I could disable it, but then barfed on the install. So, I tried it with Beryl enabled, and it still worked ok. Great How To!

It will sometimes work with Beryl enabled, depends on the precise video hardware. My wireless nic (ipw2200) comes back on after suspend and hibernate. It might be a case of putting NetApplet in your systray, or sometimes even running a terminal as root and giving the command "ifup eth0" or whatever your wireless connection is labelled. Or if you can do a simple script, maybe have a loop running as root in the background, which checks if your net connection is up and starts it if it isn't.

I'm just glad it works for someone, I was looking into this for myself, persuaded ocilent1 to add the initramfs module to the kernel and Tex to add iasl, then found I didn't need the DSDT stuff at all!
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Scotty Dog

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #5 on: March 14, 2007, 12:22:24 AM »
I tried the NetApplet and the ifup command, and neither are working. NetApplet just keeps telling me the connection is down, and ifup tells me the the device is not found. I wonder if I am going to need to go the DSDT route. What are your thoughts?

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #6 on: March 14, 2007, 07:56:05 AM »
If you only followed the first part and your computer wakes up without DSDT tables added, then do not add DSDT table. If your wireless doesn't come on, the problem is different and is not connected to this. It may be that firmware needs uploading again on restart?

What happens if, on wakeup, you do, as root,

modprobe -f acx111
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Scotty Dog

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #7 on: March 14, 2007, 11:19:16 PM »
I get a message saying....

FATAL: Module acx111 not found.

The actual driver files are tiacx111c16, 17, or 19, and I tried all of them with the same result. Just for grins, I also tried deleting and reinstalling my wireless nic, which I have to do for the Belkin PCI wireless card in my desktop every time I reboot, but although it would reinstall the nic following a suspend, it would not reactivate it and acquire a signal until I rebooted.

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #8 on: March 15, 2007, 09:03:27 AM »
What we are looking for is a way to force the nic to start on reboot. Then it might be a case of hacking the suspend/hibernate scripts and adding the necessary commands.

Just an idea for the devs, but maybe there should be some kind of file similar to rc.local which allows the user to add their own commands, but when coming back from a suspend or hibernate.
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Scotty Dog

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #9 on: March 16, 2007, 05:02:22 PM »
Another thing I just tried is adding wlan0 mac=(mac address) to /lib/modules/modprobe.conf. The result was that at least it recongnized the nic, and returned a message that it was getting IP information for Wlan0. However, it came back to a prompt with no connection still. I don't know why it is ignoring the presence of the module in /lib/modules in the first place though.

Another option that occurs to me is that I know that some adapters install automatically at install, so they must be compiled into the kernel? I wonder if getting a wireless nic that is automatically recognized and works without hacking in the first place as is necessary with the tiacx111 chipset would solve the problem. My daughter has a laptop that has built in wireless that worked flawlessly with the live CD, but she is a little suspicious of me wanting to "borrow" some of her HD space.  ;)

viking

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #10 on: April 01, 2007, 04:17:09 AM »
Good piece of work davecs - well done.

I have a laptop with what I assume is an acpi problem - on every boot the first line I get is "ibm_acpi ec object not found" and every shutdown I finish with the line "acpi power off called" after which it hangs indefinitely until I hold down the power button to shut down fully.

I was naturally interested in your post, but disappointed to find that my laptop manufacturer (Evesham Technology) is not even mentioned in the list on the sourceforge dsdt page despite being a fairly major player in the UK.

Undaunted, I set about decompiling and error checking my own dsdt file and found that according to iasl, it has no errors.

I wonder if you have any ideas where I might proceed from here, is this really an acpi problem or is it something else?

Incidentally, the laptop will reboot and hibernate (to disk) successfully but will not recover from suspend and will not shutdown fully. It is only the shutdown function I am interested in I never use hibernate or suspend.

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #11 on: April 01, 2007, 06:13:55 AM »
iasl is only a compiler/decompiler, so if the info is wrong, but consistent, I suppose it will not show any errors. As Evesham is an own brand, it may be that the BIOS/spec matches another, branded, computer and you can get it going that way.

I don't really know a great deal about how all this works, by extracting and attempting to debug your own DSDT you are already ahead of me, I just read up a few web sites, took a few risks as I was prepared to re-install if necessary, and wrote a How-to by extracting what you actually have to do from all the confusing stuff that I couldn't understand.

Sorry can't help more than that.
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

viking

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #12 on: April 01, 2007, 10:26:24 AM »
Quote
by extracting and attempting to debug your own DSDT you are already ahead of me

 :D :D :D

Me, ahead of anybody with linux that's a laugh!!

No problem anyway davecs thanks for the initial post, if it wasn't for that I wouldn't have ever known what a dsdt was ???

nino

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #13 on: April 02, 2007, 07:26:54 PM »
I found this lhttp://forums.gentoo.org/viewtopic.php?t=122145helpful in the past

viking

  • Guest
Re: Laptops: Suspend, Hibernate and DSDT
« Reply #14 on: April 04, 2007, 09:07:20 AM »
I found this lhttp://forums.gentoo.org/viewtopic.php?t=122145helpful in the past



Thanks for the link nino, I had a look at the site but I must say it looks like pretty scary stuff really, I could see myself getting into a bit of bother trying to follow it so I'll probably leave it for now, but thanks anyway.