Jump to content

Suspend/Hibernate on laptop


lewmur

Recommended Posts

* Split off from Mandriva thread . . . . by BrunoNow if I could just get "suspend" and/or "hibernate" to work. I turned them on in "Klaptop" but neither one works. Hibernate goes through its script and everything looks good until it calls the acpi shutoff routine. The computer doesn't turn off and after doing it manually and restarting it hangs. I have to turn it off again manually and let it go through the regular boot. When I try Suspend, I don't see the shutoff call but the script stays on the screen without Suspending but locks up. Nothing but a restart will wake it up.Of course, this isn't just a Drake problem. I haven't found a Linux distro yet that it works on this laptop. If it was an "off brand," I'd accept the blame myself. But one would think that HP would adhere to the ACPI standard.

What is the appendline in /etc/lilo.conf ?
# cat /etc/lilo.conf

:D Bruno

I don't see one. I may be wrong but I think the problem may have something to do with the fact that I'm not using eth0, but can't seem to delete it. I use a gigabit PCMCIA card for my LAN but the bios won't let me disable the built in NIC.
Link to comment
Share on other sites

LOL . . . . Lew . . . . Just post me the results of

# cat /etc/lilo.conf

And I will have a look what is there . . See this is the part I am after:

image=/boot/vmlinuz        label="linux"        root=/dev/hdb9        initrd=/boot/initrd.img      append="acpi=ht splash=silent"        vga=788        read-only
B) Bruno
Link to comment
Share on other sites

I will do some research . . . but in the mean time you could try to add 2 sections to your lilo.conf:

image=/boot/vmlinuz        label="linux-2"        root=/dev/hdb???        initrd=/boot/initrd.img      append="acpi=ht  resume=/dev/hda6 splash=silent"         vga=788        read-onlyimage=/boot/vmlinuz        label="linux-3"        root=/dev/hdb9        initrd=/boot/initrd.img      append="acpi=off resume=/dev/hda6 splash=silent"        vga=788        read-only
Write the lilo to MBR and see if any of the extra entries we made makes any difference."acpi=off apm=on" might be another option . . . B) BrunoPS: Maybe we should split this off in a separate topic ??
Link to comment
Share on other sites

Found something:

Since a while ago Mandrake have included the Swsusp (short for Software Suspend) scripts in a package called "suspend scripts". This works nearly flawlessly with the Presario 732US laptop. The only problem that I have not resolved is that after a resume the volume levels are all at 0. Here's how to get it to work:      1. You have to have a swap partition that is at least as large as your RAM (for this model something around 240 MB).       2. Edit /etc/sysconfig/suspend            a) Set RESTORE_SOUND= to "yes"             B) Add the name of the kernel module for the sound card (in this case snd-via82xx) to the list of SOUND_MODULES= (if it is not already there)             c) Append resume=/dev/hdax (where x is the number of your swap partition) to your boot config. (/boot/grub/menu.lst is the config file if you use grub)       3. Reboot.
Source: http://www.pantropy.net/linux/laptop/tuxtop.htmlAnd:
     ACPI overrides APM in its functions and callings. On my laptop it works rather well, and coupled with swsusp is a dream to suspend to disk.     To get swsusp going, I cannot do better than to recommend the patch for it from:         http://swsusp.sf.net     A kernel compilation is again going to have to ensue, but afterwards, you can do cool things like: sudo echo 4 > /proc/acpi/sleep    which will dump everything onto your swapspace.
Source: http://linuxgazette.net/issue99/TWDT.htmlB) Bruno
Link to comment
Share on other sites

Update. I added the two options to the lilo.conf and tried both of them. Linux-2 shows no change. Linux-3 failed to boot. I did change the line "root=" to "hda7." In the process of trying all of this I noticed something I should have noticed to begin with. The computer hangs even if I do a normal shutdown. It does it with both Linux and Linux-2. So it isn't just the Hibernate and Suspend functions giving trouble.As to the Swsusp solution, it will take an awfuf lot of hand-holding for me to do any kind of re-compile.
Link to comment
Share on other sites

Hi LewFrom what I understand "Swsusp" should be included in Mandriva ( and in that case you will not have to compile the kernel ) . . . . maybe have a look in the MCC and see if it is installed ?:) Bruno

Link to comment
Share on other sites

Hi LewFrom what I understand "Swsusp" should be included in Mandriva ( and in that case you will not have to compile the kernel ) . . . . maybe have a look in the MCC and see if it is installed ?:) Bruno

It isn't in the list of software in MCC. Are there any known issues with shutdown failure? Laptop or not? Edited by lewmur
Link to comment
Share on other sites

Did you try ht=off?  For some reason having that set to on messes up shutdown on some computers (including mine).

When I choose either acpi=off or acpi=ht the computer shutsdown OK but I don't have the Battery Monitor Icon and can't Suspend or Hibernate. If I choose ht=off, I don't have the Monitor and it still doesn't Shutdown. Edited by lewmur
Link to comment
Share on other sites

Hi LewI did find the info we need . . . . . first install:From MCC

Name: hibernateVersion: 1.05-1mdkSize: 148 KBSummary: Software suspend 2 hibernate scriptDescription: hibernate is a shell script that handles the process of getting ready to suspend to disk and to resume from disk. It requires the Software Suspend 2 patches available at http://softwaresuspend.berlios.de/ After installing you will want to run 'hibernate -h' to see available options and modify your /etc/hibernate/hibernate.conf to set them.
This is the patch: Software Suspend 2.1.8 for kernel 2.6.11Here is the HOWTO: http://www.suspend2.net/HOWTOAlso Install kernel-source ( MCC ) and read: /usr/src/linux-2.6.11-6mdk/Documentation/power/swsusp.txt
From kernel/suspend.c: * BIG FAT WARNING ********************************************************* * * If you have unsupported (*) devices using DMA... *                              ...say goodbye to your data. * * If you touch anything on disk between suspend and resume... *                              ...kiss your data goodbye. * * If your disk driver does not support suspend... (IDE does) *                              ...you'd better find out how to get along *                                without your data. * * If you change kernel command line between suspend and resume... *                              ...prepare for nasty fsck or worse. * * If you change your hardware while system is suspended... *                              ...well, it was not good idea. * * (*) suspend/resume support is needed to make it safe.You need to append resume=/dev/your_swap_partition to kernel commandline. Then you suspend byecho shutdown > /sys/power/disk; echo disk > /sys/power/state. If you feel ACPI works pretty well on your system, you might tryecho platform > /sys/power/disk; echo disk > /sys/power/stateArticle about goals and implementation of Software Suspend for Linux~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Author: Gábor KutiLast revised: 2003-10-20 by Pavel MachekIdea and goals to achieveNowadays it is common in several laptops that they have a suspend button. Itsaves the state of the machine to a filesystem or to a partition and switchesto standby mode. Later resuming the machine the saved state is loaded back toram and the machine can continue its work. It has two real benefits. First wesave ourselves the time machine goes down and later boots up, energy costsare real high when running from batteries. The other gain is that we don't have tointerrupt our programs so processes that are calculating something for a longtime shouldn't need to be written interruptible.swsusp saves the state of the machine into active swaps and then reboots orpowerdowns.  You must explicitly specify the swap partition to resume from with``resume='' kernel option. If signature is found it loads and restores savedstate. If the option ``noresume'' is specified as a boot parameter, it skipsthe resuming.In the meantime while the system is suspended you should not add/remove anyof the hardware, write to the filesystems, etc.Sleep states summary====================There are three different interfaces you can use, /proc/acpi shouldwork like this:In a really perfect world:echo 1 > /proc/acpi/sleep      # for standbyecho 2 > /proc/acpi/sleep      # for suspend to ramecho 3 > /proc/acpi/sleep      # for suspend to ram, but with more power conservativeecho 4 > /proc/acpi/sleep      # for suspend to diskecho 5 > /proc/acpi/sleep      # for shutdown unfriendly the systemand perhapsecho 4b > /proc/acpi/sleep      # for suspend to disk via s4biosFrequently Asked Questions==========================Q: well, suspending a server is IMHO a really stupid thing,but... (Diego Zuccato):A: You bought new UPS for your server. How do you install it withoutbringing machine down? Suspend to disk, rearrange power cables,resume.You have your server on UPS. Power died, and UPS is indicating 30seconds to failure. What do you do? Suspend to disk.Ethernet card in your server died. You want to replace it. Yourserver is not hotplug capable. What do you do? Suspend to disk,replace ethernet card, resume. If you are fast your users will noteven see broken connections.Q: Maybe I'm missing something, but why don't the regular I/O paths work?A: We do use the regular I/O paths. However we cannot restore the datato its original location as we load it. That would create aninconsistent kernel state which would certainly result in an oops.Instead, we load the image into unused memory and then atomically copyit back to it original location. This implies, of course, a maximumimage size of half the amount of memory.There are two solutions to this:* require half of memory to be free during suspend. That way you canread "new" data onto free spots, then cli and copy* assume we had special "polling" ide driver that only uses memorybetween 0-640KB. That way, I'd have to make sure that 0-640KB is freeduring suspending, but otherwise it would work...suspend2 shares this fundamental limitation, but does not include userdata and disk caches into "used memory" by saving them inadvance. That means that the limitation goes away in practice.Q: Does linux support ACPI S4?A: Yes. That's what echo platform > /sys/power/disk does.Q: My machine doesn't work with ACPI. How can I use swsusp than ?A: Do a reboot() syscall with right parameters. Warning: glibc gets inits way, so check with strace:reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, 0xd000fce2)(Thanks to Peter Osterlund:)#include <unistd.h>#include <syscall.h>#define LINUX_REBOOT_MAGIC1    0xfee1dead#define LINUX_REBOOT_MAGIC2    672274793#define LINUX_REBOOT_CMD_SW_SUSPEND    0xD000FCE2int main(){    syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,            LINUX_REBOOT_CMD_SW_SUSPEND, 0);    return 0;}Also /sys/ interface should be still present.Q: What is 'suspend2'?A: suspend2 is 'Software Suspend 2', a forked implementation ofsuspend-to-disk which is available as separate patches for 2.4 and 2.6kernels from swsusp.sourceforge.net. It includes support for SMP, 4GBhighmem and preemption. It also has a extensible architecture thatallows for arbitrary transformations on the image (compression,encryption) and arbitrary backends for writing the image (eg to swapor an NFS share[Work In Progress]). Questions regarding suspend2should be sent to the mailing list available through the suspend2website, and not to the Linux Kernel Mailing List. We are workingtoward merging suspend2 into the mainline kernel.Q: A kernel thread must voluntarily freeze itself (call 'refrigerator').I found some kernel threads that don't do it, and they don't freezeso the system can't sleep. Is this a known behavior?A: All such kernel threads need to be fixed, one by one. Select theplace where the thread is safe to be frozen (no kernel semaphoresshould be held at that point and it must be safe to sleep there), andadd:            if (current->flags & PF_FREEZE)                    refrigerator(PF_FREEZE);If the thread is needed for writing the image to storage, you shouldinstead set the PF_NOFREEZE process flag when creating the thread.Q: What is the difference between between "platform", "shutdown" and"firmware" in /sys/power/disk?A:shutdown: save state in linux, then tell bios to powerdownplatform: save state in linux, then tell bios to powerdown and blink          "suspended led"firmware: tell bios to save state itself [needs BIOS-specific suspend          partition, and has very little to do with swsusp]"platform" is actually right thing to do, but "shutdown" is mostreliable.Q: I do not understand why you have such strong objections to idea ofselective suspend.A: Do selective suspend during runtime power managment, that's okay. Butits useless for suspend-to-disk. (And I do not see how you could useit for suspend-to-ram, I hope you do not want that).Lets see, so you suggest to* SUSPEND all but swap device and parents* Snapshot* Write image to disk* SUSPEND swap device and parents* PowerdownOh no, that does not work, if swap device or its parents uses DMA,you've corrupted data. You'd have to do* SUSPEND all but swap device and parents* FREEZE swap device and parents* Snapshot* UNFREEZE swap device and parents* Write* SUSPEND swap device and parentsWhich means that you still need that FREEZE state, and you get morecomplicated code. (And I have not yet introduce details like systemdevices).Q: There don't seem to be any generally useful behavioraldistinctions between SUSPEND and FREEZE.A: Doing SUSPEND when you are asked to do FREEZE is always correct,but it may be unneccessarily slow. If you want USB to stay simple,slowness may not matter to you. It can always be fixed later.For devices like disk it does matter, you do not want to spindown forFREEZE.Q: After resuming, system is paging heavilly, leading to very bad interactivity.A: Try runningcat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/nullafter resume. swapoff -a; swapon -a may also be usefull.
;) Bruno
Link to comment
Share on other sites

Hi LewI did find the info we need . . . . . first install:From MCC This is the patch: Software Suspend 2.1.8 for kernel 2.6.11Here is the HOWTO: http://www.suspend2.net/HOWTOAlso Install kernel-source ( MCC ) and read: /usr/src/linux-2.6.11-6mdk/Documentation/power/swsusp.txtB) Bruno

Bruno;I've printed this out and am going to spend some time reading it an working up my courage to try implementing it.ThanksLew
Link to comment
Share on other sites

Hi LewI just found this on cooker:

> Hibernate:> Does not work because hibernate can not stop mDNSresponder.> But is i stop it on the command line the hibernate works> so I disable mDNSresponder and nifd services.The mDNSresponder is set to restart before suspend.Have a look at RESTART_SERVICES in /etc/sysconfig/suspendIs it better if you add nifd there ?
:"> Bruno
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...