[SOLVED] acpid, pm-utils, suspend/resume and -current
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've searched around this forum but couldn't get any straight pointers so I'm sorry if this has already been answered. I've always used desktops and never really paid any attention to whole suspend/resume discussion but I recently bought a laptop and would like to suspend/hibernate the laptop. I'm using -Current and XFCE and particularly like xfce power manager.
However, I'm having trouble suspending my laptop and am looking for some answers. I'm sure I'll have many more questions as I learn more about this but I'll start with a few pressing ones.
1. Should I use rc.acpid or xfce power manager or both. Currently I have rc.acpid running and also xfce power manager.
2. I've set xfce power manager to suspend when I close the laptop lid but it never suspends. However, the laptop successfully suspends after specified inactivity timeout. I've provided the /var/log/pm-suspend.log which shows success.
3. How do I bring the system back from suspended state? I've tried everything but I only see screen flashes and nothing seems to happen. Only choice I have is to press the power button which restarts the system (since rc.acpid is running).
BTW, I'm using x86-Current on Toshiba L305-S5946. I haven't tried suspend to disk yet but I have my swap partition set to twice the ram size (which I found from one of Robby's post).
Usually what I do, is just use the rc.acpi script and add
Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) pm-suspend
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
the bold part to /etc/acpi_handler.sh. I usually have to run pm-suspend once after reboot to suspend it, but after that, I can just close the lid and it suspends it. To bring it back up, just open the lid. You also want to make sure that your user is in the power group.
Usually what I do, is just use the rc.acpi script and add
the bold part to /etc/acpi_handler.sh. I usually have to run pm-suspend once after reboot to suspend it, but after that, I can just close the lid and it suspends it. To bring it back up, just open the lid. You also want to make sure that your user is in the power group.
Thanks for the code snippet. I tried but unfortunately it didn't work. I added the relevant part and restarted acpid daemon. Closed the lid but the laptop is still running. I'm part of the power group. Here's the relevant groups info
Code:
raghu@sisrana:[/proc]$ groups
users wheel floppy audio video cdrom games plugdev power netdev scanner
After you edit the file, restart acpi then run pm-suspend. I'm not sure if it has to create a pid lock in var or something, but I always have to do that after I reboot. I have it working on -current64 and 12.2. 12.2 is on a laptop probably just like yours. It's a Toshiba L305D-S5934. The laptop is a full vanilla install and all I edited was the /etc/acpi_handler.sh script. -Current is also on it, same file edited.
Thanks for the follow-up. I restarted acpid after I edited acpi_handler.sh and ran pm-suspend and it sure works fine. System goes into suspend mode but I can't bring it out of suspend...all I get is a blank screen...I've punched all keys on the keyboard but nothing seems to help. I simply have to hit power button and laptop restarts.
Even after reboot, I still can't suspend just by closing the lid.
1. Should I use rc.acpid or xfce power manager or both. Currently I have rc.acpid running and also xfce power manager.
In general, you use one or the other. If you have acpi hooks *and* a power manager catching events, then you *will* get a "double suspend" -- in other words, the first one to get the event will initiate a suspend, then when you wake up, the other one will catch the other event, and you suspend again.
This is a bit aggravating, at least for me, because I like to suspend via my laptop's sleep key from the gdm/kdm/xdm/whateverdm screen, and that requires me to have acpid catch the sleep event, so I have to tell xfce-power-manager to ignore the sleep key. [1]
[1] I'm going to put the footnote here instead of at the bottom so that the context isn't forgotten by the time you get there. I can't figure out a way to tell kdm to suspend unless I edit the command that's run when I invoke the "Reboot" or "Shutdown" buttons, and that's an ugly workaround IMHO - it should also offer "Sleep" and/or "Suspend" and "Hibernate" or at least the ability to configure custom functions. The good news is that gdm *does* offer that ability (both the suspend *and* custom functions), so I just use gdm and leave acpid out of the equation. Once 13.0 is out, you can get a gdm that "just works" from SlackBuilds.org - I've tweaked it quite a bit compared to the 12.2 version we have.
Quote:
2. I've set xfce power manager to suspend when I close the laptop lid but it never suspends. However, the laptop successfully suspends after specified inactivity timeout. I've provided the /var/log/pm-suspend.log which shows success.
** snipped logs **
Okay, this is at least partially good news. It sounds as if the problem isn't that the laptop *cannot* or *will not* suspend -- it's that it doesn't suspend when the lid is closed? Am I correct on that? (ignore whether it will wake up correctly - that's another topic).
If I'm correct, then I'm not sure exactly what's going on, and I may have to talk with upstream about it, but at least we'll have some idea of how to proceed.
Quote:
3. How do I bring the system back from suspended state? I've tried everything but I only see screen flashes and nothing seems to happen. Only choice I have is to press the power button which restarts the system (since rc.acpid is running).
Have you tried ssh'ing into the machine after those "screen flashes and nothing" happen? :-) It sounds like video is the only thing that isn't coming back, and if that's the case, we can almost surely figure out how to work around that.
Try logging in as root from a console (in runlevel 3 - no X running at all anywhere) and do "pm-suspend" - then close the lid, wait a few minutes, and open the lid.
In general, you use one or the other. If you have acpi hooks *and* a power manager catching events, then you *will* get a "double suspend" -- in other words, the first one to get the event will initiate a suspend, then when you wake up, the other one will catch the other event, and you suspend again.
This is a bit aggravating, at least for me, because I like to suspend via my laptop's sleep key from the gdm/kdm/xdm/whateverdm screen, and that requires me to have acpid catch the sleep event, so I have to tell xfce-power-manager to ignore the sleep key. [1]
[1] I'm going to put the footnote here instead of at the bottom so that the context isn't forgotten by the time you get there. I can't figure out a way to tell kdm to suspend unless I edit the command that's run when I invoke the "Reboot" or "Shutdown" buttons, and that's an ugly workaround IMHO - it should also offer "Sleep" and/or "Suspend" and "Hibernate" or at least the ability to configure custom functions. The good news is that gdm *does* offer that ability (both the suspend *and* custom functions), so I just use gdm and leave acpid out of the equation. Once 13.0 is out, you can get a gdm that "just works" from SlackBuilds.org - I've tweaked it quite a bit compared to the 12.2 version we have.
Robby, Thanks for a detailed answer on this one. Sorry I couldn't respond quickly...was travelling with family. I'm looking forward to new gdm when 13 comes out. In the meantime, I'll not use acpid daemon and only use xfce power manager.
Quote:
Originally Posted by rworkman
Okay, this is at least partially good news. It sounds as if the problem isn't that the laptop *cannot* or *will not* suspend -- it's that it doesn't suspend when the lid is closed? Am I correct on that? (ignore whether it will wake up correctly - that's another topic).
If I'm correct, then I'm not sure exactly what's going on, and I may have to talk with upstream about it, but at least we'll have some idea of how to proceed.
You are correct. pm-suspend when run as root works but the laptop won't suspend when I simply close the lid.
Quote:
Originally Posted by rworkman
Have you tried ssh'ing into the machine after those "screen flashes and nothing" happen? :-) It sounds like video is the only thing that isn't coming back, and if that's the case, we can almost surely figure out how to work around that.
Try logging in as root from a console (in runlevel 3 - no X running at all anywhere) and do "pm-suspend" - then close the lid, wait a few minutes, and open the lid.
No I haven't had to chance to try this. Let me switch back to the stock kernel and try these steps. I forgot to mention that I'm using 2.6.30.4 custom kernel with kernel mode setting enabled by default. My kernel config is based on stock config file but I've removed some unwanted drivers and enabled fscache.
One more question, pm-utils writes log when machine goes into suspend (/var/log/pm-suspend.log) so is there a way to log events when machine comes out of suspend mode?
You are correct. pm-suspend when run as root works but the laptop won't suspend when I simply close the lid.
In that case, consider opening a bug against xfce4-power-manager or mailing Ali directly. Whichever way you go, CC me using rw AT rlworkman.net -- that's my registered mail in xfce's bugzilla too.
Quote:
Let me switch back to the stock kernel and try these steps. I forgot to mention that I'm using 2.6.30.4 custom kernel with kernel mode setting enabled by default. My kernel config is based on stock config file but I've removed some unwanted drivers and enabled fscache.
KMS throws some extra kinks in this, as it disables all of the quirks that would otherwise be used (ideally, they're not needed any more). In my experiences here, KMS is far from what it promises to be - fwiw.
Quote:
One more question, pm-utils writes log when machine goes into suspend (/var/log/pm-suspend.log) so is there a way to log events when machine comes out of suspend mode?
Have you tried ssh'ing into the machine after those "screen flashes and nothing" happen? :-) It sounds like video is the only thing that isn't coming back, and if that's the case, we can almost surely figure out how to work around that.
After machine suspends via pm-suspend (power led turns flashing amber), opening the lid doesn't wake it up. The only button that seems to work is a small media key...kinda brings the led (power, hdd) to green but nothing on the screen. Screen seems as it is turned off.
Can't ssh from another machine...I've tried it with both wired and wireless connection.
BTW, the machine can suspend both via console (pm-suspend command) or via xfce power manager.
Quote:
Originally Posted by rworkman
Try logging in as root from a console (in runlevel 3 - no X running at all anywhere) and do "pm-suspend" - then close the lid, wait a few minutes, and open the lid.
From runlevel 3, machine goes into suspend mode but doesn't come back. opening/closing lid has no effect. Screen seems completely turned off...only resort is to reboot.
Quote:
Originally Posted by rworkman
Wakeup events are also written to that same file.
I guess in that case, my machine doesn't wake up because there are no entries for wakeup in /var/log/pm-suspend.log. All it reports is success for pm-suspend.
BTW, I've tried all this via both stock kernel and custom kernel with same results.
Quote:
Originally Posted by rworkman
In that case, consider opening a bug against xfce4-power-manager or mailing Ali directly. Whichever way you go, CC me using rw AT rlworkman.net -- that's my registered mail in xfce's bugzilla too.
I think I have found a potential solution. I had to add kernel boot parameter and add hal entries for correct pm-suspend command. Here's what I did. After a lot of googling, I used acpi_osi=Linux boot parameter mentioned on this blog which I found after trudging in archives of toshiba_acpi dev site here.
Later today I found this ubuntu bug list which pretty much confirmed a similar situation I was facing. Someone suggest adding hal video entry which I tried and voila!!! my laptop not only suspends (which it did earlier) but resumes successfully. Here's relevant entry from /var/log/pm-suspend.log
For people interested in the
solution, here's my grub entry with the acpi_osi kernel parameter
Code:
title Slackware Linux
root (hd0,4)
kernel /vmlinuz ro root=/dev/slacklvm/root vga=773 acpi_osi=Linux
initrd /initrd.img
Here's the hal entry for /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-toshiba.fdi. I've added the entry below 2nd entry for Satellite Laptops
I think I have found a potential solution. I had to add kernel boot parameter and add hal entries for correct pm-suspend command. Here's what I did. After a lot of googling, I used acpi_osi=Linux boot parameter mentioned on this blog which I found after trudging in archives of toshiba_acpi dev site here.
Later today I found this ubuntu bug list which pretty much confirmed a similar situation I was facing. Someone suggest adding hal video entry which I tried and voila!!! my laptop not only suspends (which it did earlier) but resumes successfully. Here's relevant entry from /var/log/pm-suspend.log
Code:
Initial commandline parameters: --quirk-s3-mode
--quirk-vbe-post
Wed Aug 12 22:08:19 CDT 2009: Running hooks for suspend.
... blahblahblah log noise ... :-)
Wed Aug 12 22:08:48 CDT 2009: Finished.
Okay, I'm with you, I think, but there's a bit of a problem...
Quote:
Here's the hal entry for /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-toshiba.fdi. I've added the entry below 2nd entry for Satellite Laptops
That ^^^ tells me you are trying to remove the s3_bios quirk because you only need the vbe_post one.
However, the "Initial commandline parameters:" of the pm-suspend command clearly show that the s3_bios quirk is still being passed along.
Quote:
For people interested in the
solution, here's my grub entry with the acpi_osi kernel parameter
Code:
title Slackware Linux
root (hd0,4)
kernel /vmlinuz ro root=/dev/slacklvm/root vga=773 acpi_osi=Linux
initrd /initrd.img
For lilo.conf, that's just a line like this in your kernel stanza:
Code:
append = "acpi_osi=Linux"
However, that doesn't make sense to me at all that you would need to do this - it seems like a kernel bug to me.
Quote:
I would like to thank everyone who replied. A special thank you goes to Robby Workman for patience and long explanatory posts. Thanks Robby!!!
You're welcome - I like a good mystery :-)
Quote:
EDIT: Just wanted to document that hibernate works perfectly...only suspend had problem which is now solved.
See, that just further confuses me. If hibernate is working, then the message I get is that reinitializing the bios is playing a key role in making everything work again, so I would expect you to NEED the s3_bios quirk :/
That ^^^ tells me you are trying to remove the s3_bios quirk because you only need the vbe_post one.
However, the "Initial commandline parameters:" of the pm-suspend command clearly show that the s3_bios quirk is still being passed along.
May be I'm not knowledgeable enough to dispute what you're saying but I read that as originally --quirk-s3-mode is the initial command line option for pm-suspend which is later replaced by --quirk-vbe-post.
Thanks for relevant line for lilo config. I just did a little test of possible scenarios. Let me know if this is flawed.
I tested suspend/resume with and without acpi_osi boot parameter:
I restarted rc.hald after each change to the hal fdi files.
Without acpi_osi boot parameter with power_management.quirk.s3_bios set to true
laptop doesn't suspend when lid is closed
with power_management.quirk.s3_bios set to false
laptop doesn't suspend when lid is closed
With acpi_osi boot parameter with power_management.quirk.s3_bios set to true
laptop goes into suspend on lid closing but screen is completely off when I open the lid
with power_management.quirk.s3_bios set to false
laptop goes into suspend on lid closing and wakes up correctly (with video).
Clearly, only with acpi_osi boot parameter and power_management.quirk.s3_bios set to false I get a working suspend/resume system.
Don't know if this is a kernel bug but seems to work in my case. This may well be a hack so I'm completely open to any straightforward/logical solution.
I am not sure if this is the same issue as you were having but I was able to suspend to ram without a problem, then when i resumed by opening the laptop lid, all i had was a flashing cursor in the top left hand corner of the screen. Other than rebooting, to get back functionality I would have to alt-f2 to switch the tty i was on - and when i went back to the original tty, naturally xwindows crashed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.