ACPI and S3 Sleep on the Linux Desktop?
"For those of you not familiar with S3, this feature allows you to save the current state of your machine to RAM, power down all of your internal devices (PCI cards, AGP, CPU) and shut down down all your fans. The machine is now in a deep sleep, using but only a few watts to keep the RAM refreshed. Pressing a key or the power switch brings you back to your desktop and applications in a matter of seconds. In contrast to leaving your machine on constantly, and with today's high wattage processors and graphics cards, using S3 is not only environmentally friendly, but can save you more than a few bucks on your electric bill. Getting Linux and ACPI working is a whole other story. I have had no luck getting ACPI sleep states working on an Intel D875PBZ motherboard, even with extensive help from the gentlemen on the ACPI mailing list."
I have never, ever, in all the years of using Windows or Linux had suspend, either S3 or suspend-to-disk work properly. None of the machines (many of them at this point) ever resumed, forcing a hard reset, fsck, and all the usual attendant issues. It also doesn't matter the vintage of the machine, or even the vintage of the OS. My experience (or lack of a successful one) spans everything from Linux kernel 2.0 and Windows 95 to kernel 2.4 and Windows 2000 Pro.
Bleakness... Desolation... Plastic Forks...
Using a stock 2.6.x kernel, I've gotten my Dell Latitude C610 to sleep fully and come out of it 95% of the time. The other 5% of the time I get weird video issues. I've not taken the time to debug this properly yet. I use "echo 3 > /proc/acpi/sleep" to put it to sleep, and pressing the power button brings it out.
Hope this helps.
As I type this I have a uptime of about 4 days. I have found on mac systems the sleep and resume features are excellent. I never turn off this machine and just wake it from sleep all the time. Works great. My sisters x86 though.....not so great, resuming take forever and sometimes the thing just crashes on resume.
Mandrake 10 was crashing my nforce2 board all the time, read slashdot actually, that turning off acpi and apic fixed the issues. It did, my AMD box is stable now. Not sure why its on by default it not stable, not a good experience for a new distros with 2.6 kernels.
A buddy of mine was having the same issue with Gentoo, so I think its a common issue. Wonder how the BSD kernel support for nforce is stable?
I've stuck with the 2.4 kernel on my servers for now, if my workstation isn't stable on 2.6.x, its not touching my server. imho
I've only had my iBook a few months, but in that time I've rebooted/shut it down... three times? four? Usually only when an Apple software update requires me to.
Its just so much easier unplugging everything and closing the screen than it is waiting for the machine to boot down, and of course the same goes for booting up.
I wouldn't do without it now.
(Last "reboot" was two weeks ago, after an apple update)
I swear, if I see another Slashdot comment with "It will be interesting to see"...
My box never sleeps.
HD is all ways spinning uploading and downloading for P2P.
It's all about the pr0n biziches.
S3 suspend works fine for me under WinXP, but I can't say that I've ever used it except to see if it really worked. I don't really know anyone who's ever used it except on a laptop that suspends when the lid is closed, and they only use it them because that's default behaviour for their hardware.
I'm sure it's a valuable feature for those who really use it, and that there are many advantages that people will point out like saving application states etc. But for me and everyone I know, except the laptop users I mentioned whose hardware automatically suspends, we either have our PC's on 24/7 or turn them off when not in use. Mine is on 24/7 for broadband filesharing, while the average users I know just turn their computers on and off as needed.
Personally, I found myself wanting an application-specific suspend-to-disk option for saving Mozilla tabs whenever I have to reboot every few weeks for hardware/driver/general-wonkyness reasons, since I have the nasty habit of queueing up a bunch of pages for later reading. But I've never had a reason personally to want to suspend the whole system state.
Chasing Amy
(We all chase Amy...)
"The more corrupt the state, the more numerous the laws"-Tacitus
You can use Tab Browser Extentions to save your tab session, either on log off automatically, or manually. Be warned, there is some slightly weird menu placement, partially due to the fact that the author is not a native English speaker. I believe Opera does this automatically, with Nordic instead of Japanese authors.
You like splinters in your crotch? -Jon Caldara
Windows 95 was often accused of being incredibly unstable, on through Windows 98. ME got weird, but many found it more stable. And with XP and 2000 it seems to have gotten rock solid. Is this the kernel maturing? Only slightly.
Drivers for all versions of Windows and Linux run in ring 0. They have the capability to bring the kernel down just as hard as a bug in the memory manager. This is the cost of not running a true microkernel, but it's been found often too hard to efficiently transfer large amounts of data through the levels of abstraction of a microkernel. As such, we have the situation we're in now.
Whenever a power change occurs, a message needs to be sent to every driver asking it to do whatever it needs to do. Often enough, what it needs to do is nothing at all. But even in such a simple case, the driver can hose up, and bring the machine crashing down. Heck, your machine might even have been in a stable state until you brought it awake from hibernating. Then, on getting the awake message, your NVidia driver corrupted something it shouldn't have, and it all comes tumbling down.
When faced with this in Windows 95 and 98, Microsoft started its signed driver initiative and manufacturers got better at writing drivers. Now, good hardware manufacturers get their drivers vetted, then signed by Microsoft. And Windows XP becomes stable.
Linux might be in a similar position if either (1) companies got much better at writing Linux drivers or (2) more companies opened the source to their drivers.
You like splinters in your crotch? -Jon Caldara
I have been putting my Mac (G4/400) to sleep instead of shutting down for at least 2 years. With Panther on my machine, I restart every 2 months or so. I don't log out very often either (like every 2 months or so).
sleep is good. If I can't get any, at least my computer can.
seriously, it wakes up in 4 or 5 seconds. It takes almost a minute to restart.
Panther seems to restart a lot faster than Jaguar. Anyone else notice this or am I just hallucinating again?
Where's Robin Hood? We could kinda really use him now.
I for one, hope that more information gets posted about this. I think that embedded systems could benefit significantly from this.
Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
- Kernel Panic at boot
- Failure to recognize the power management hardware, such as batteries
Failing to get ACPI working, I've had resonable success with using APM sleep and suspend-to-disk on those machines. Just my two cents. YMMVACPI is apparently really, really hard to get right, and not just for the OS developers. Hardware vendors typically screw it up, too (which causes even more pain for the programmers).
APM, however, is pretty well-supported in Linux. On all five of the machines I've used as "mine" in the last three or so years, suspend has worked just fine -- as long as I disabled ACPI and used APM instead.
Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
Someone please correct me if I'm wrong, but I don't think you can call what Mac laptops do "sleep to disk". I have a G4 Powerbook, and when the lid shuts, it suspends, but from what I understand the power manager uses just a bare minimum of power to keep the data in ram, and nothing goes to disk. The whole process is instantaneous -- sleeping as soon as the lid is shut, and returning before I can get the lid fully open. I haven't even managed to fake it out by closing and opening quickly.
I'm also impressed that included in this is logic to notice hardware changes when the system is asleep (ok, more like cat-napping). For example, I typically shut the lid and disconnect my network cable at work, then bring it home and wake it to my WiFi router, OSX will automatically sense and join the new network (same in reverse). The network libraries are robust enough to not cause terrible application-level errors or crashes.
Same goes for recognizing the plugging in or removal of an external monitor during sleep, as well as all the USB devices I've tried.
I can't say I tried disconnecting a Firewire drive or PCMCIA device during sleep, which I won't try since they probably should be properly dismounted. But I bet it would mount a device while asleep (or very shortly after waking).
Granted if you took the battery out it would probably dump everything in ram, unless there's some kind of internal backup battery specifically for last minute graceful shutdown everything. But I guess that's the trade-off for not having to wait while half a gig of ram transfers to and from the disk.
Personally I would say Linux is a good year from this level of sleep mode, but then I don't follow kernel dev too closely, so who knows.
_______
2B1ASK1
I've been using my Toshiba Tecra 8000 with suspend-to-ram (S3) under Gentoo for months. It was difficult at first to get it to work, but after scripting the acpi myself, it has consistently worked. Right now I have it resuming via the power key. You can find all sorts of great hints for using ACPI/Sleep modes via the gentoo forums, even if you aren't using gentoo, the acpi script examples there are nice.
Check out ioquake3.org for a great, free, First-Person Shooter engine!
I tried for a couple hours to get it working, with a custom-built Wolk kernel, RedHat 9, and a Shuttle SN41G2 XPC. While I was finally able to get ACPI working like it should, I never did manage to get suspend to ram working.
my pda has a resume..
I only turn off my G4 and iBook for software updates, and put them to sleep when they are not in use. While there is some lag on wake (~1 sec. on iBook, 2-4 sec. on G4) this is far preferable to turning the machines off or keeping them awake. I never have any problems with it.
-
I have an apple powerbook g4 (tibook dvi) and can't praise the sleep function highly enough. Sleep on this thing is well sorted out.
You can just close the lid at any time, while playing a movie, while listening to music, etc.. and it just works. A little LED begins to gently pulse on and off and the machine is in a sleep state.
I have left it in this sleep state for really long periods of time, like a day or two. After coming out of sleep, it doesn't seem to have discharged the battery at all (always like 2 or 3 hours available)
Once, I was watching a DVD on an airplane and finally discharged the battery all the way. 5 minutes before the battery ran out, the operating system popped up a message that it would put the system to sleep in a few minutes because the battery was low. I kept on watching the dvd and a few minutes later it did put the machine to sleep.
Later when I got home, my luggage was delayed and I left the machine in sleep all night long until the next day when the luggage was delivered (along with the charger).
I plugged the charger in and opened the lid and everything was there. discharged battery, all night in sleep and still everything was preserved.
I am really really impressed with the powerbook sleep. It just works and is trustworthy.
Unless I'm going away on holiday or something, my laptop and my desktop don't get turned off, I use S3.
I've got my laptop set up so when I press the power button, it enters "standby" (Oh, this is WinXP), and its off, almost instantly.
When I want to use it again, I press power, and its on, in about 2 seconds. I reboot maybe once a month, generally for config changes.
I don't know how much power S3 uses, but its not much. My battery is fuct, and I only get 30mins of use now, but I've left my lappy on standby for about 24 hours without AC power, and there was still 40% charge or something.
Every time I see someone shut down ther PC, or especially their laptop, I think why shut the machine down? Everyone is annoyed by long boot times, but hardly anyone I know uses suspend/sleep.
Every few years/months someone starts talking about how one day computers will be like TVs or radios, no waiting around for them to boot, just press power and they are ready. Well guess what folks? We have the technology! Use it!
There's also "session saver" which is WAY more reliable than tab extensions for doing that. Tab extensions does about a bazillion other cool things, but it can't seem to reliably save the tabs when you close/crash.
Session saver is so smart that it can figure out when you have multiple windows with multiple tabs and your browser crashes.
Mucous membranes are the part of your brain that, like, make you think about mucous. --Beavis
I just decided to see what would be invloved in getting this to work, and was surprised to find that it's remarkably simple.
/etc/acpi/powerbutton.sh, put; /sbin/lilo -R "current resume=/dev/hda1" /proc/acpi/sleep
Compile a kernel with suspend-to-swap and acpi.
Install acpid (apt-get install acpid)
in
# your label and swap partition will probably be different
echo "4" >
And that's all. Works perfectly for me, I just tested it.
455fe10422ca29c4933f95052b792ab2
I've tried it under 2.6 on a couple of laptops (Fujitsu w/Transmeta and a big ugly Sony). No dice. I tried it under 2.4 with acpi patch on both. No dice. I tried it on a couple of non-laptops, too. No dice.
The word on the Fujitsu is that it is actually working properly, but that the PCI bus and/or radeon card doesn't refresh properly upon wake-up.
This is not a version of "working properly" that works very well for me. No screen, no network. Tough to work with. I think swsusp is the stand-in du jour.
I was hoping that the new Knoppix would help me get this going.
Good luck to you. I'm sure that those smart kernel hackers will bring us this good stuff eventually.
Mucous membranes are the part of your brain that, like, make you think about mucous. --Beavis
I run Win2K, and I never use suspend-to-RAM. The reason is that the CPU actually halts and does not start up again unless the user takes some explicit action. This makes it impossible to set up scheduled tasks (like backups that I run every day) to wake up the system from sleep mode.
..for Linux, especially given that the main site is hosted at Intel.
My Compaq laptop shipped with Win98ME and works (mostly) fine in W2K adn WXP.
So why, more than 3 years later, is Linux still without decent ACPI support?
I have had mixed results with sleep. I had a Compaq Presario 5000 Duron 700 win2k)as a media server that would sleep perfectly, but it would only wake up properly if you used the power button to turn it on. If you used the mouse or the keyboard the mouse to wake it, the mouse pointer dissappeared. It still worked, but but the pointer was gone. I have another P4 Presario that sleeps perfectly in XP but the exact same machine running 2k never sleeps. Its set up in Power management but it never ever goes to sleep. The new media server is on a Tyan Socket 370 board. Win2k goes to sleep just like its supposed to, but when you wake it up it goes through POST and all. But 2k returns to the exact same state. I guess thats Suspend to Disk, or whatever and a setting I could change, but I am too busy posting on /.
Well, I used the suspend to disk mode of Win XP (hibernate) all the time since my computer is rather loud, and it saves power.
I do this mainly because it is much faster than a shut down + startup. And also because I will have many programs open and I just want to pause what I'm doing and come back later.
Unfortunately this leads me to avoid shutting down at all in order to keep browser windows open mostly. Though I saw a post about a plugin for firefox to save just the tabs to disk, instead of me having to book mark them all.
If you get bad RAM, you're screwed. I have Win2k here and I just use standby. I have suspend to RAM as an option in my BIOS, but I have it disabled.
I never really investigated the difference between an 'apm -s' which I use _all_ the time and the counterparts of ACPI. Please advise. :)
on modern mobo's I've had zero problems with 2K and XP.
On a Dell laptop I had a strange problem whereby an approx 1" x 1" square would remain black in the upper left corner of the screen. It was inconsistent, and required a reboot to fix.
Things are much better for me more recently though, now I have built X.Org R6.7 and my Radeon Mobility 9700 is all good to go too.
If you don't want to build your own kernels, you needn't do that either. The latest Knoppix includes an option to boot a 2.6 kernel (type "knopix26" at the boot prompt), and I have seen success stories discussed on the Debian Laptop mailing list as well, using the standard Debian 2.6 kernel.
With the Debian kernel you have to add "acpi=on" to the Grub/Lilo command line, but that isn't needed for Knoppix.
... if I could just get the back light to shut off with my Sony Vaio under Linux. Suspend to disk/RAM is a pipe dream for me at this point. After much google'ing, I've come to the conclusion that I'm just screwed - my laptop just simply isn't "linux friendly". I seriously think I'm just going to buy an iBook for my next laptop. The 12" model really isn't all that terribly expensive for a Laptop (let alone for a Mac).
in my arsonal of boxes, ranging from a paid of PII BX boards to an Nforce2. I've had many, many issues relating to acpi.
getting a doze box to SLEEP is easy, bringing it back up has historically caused crash issues (on nforce1, a via kt333 and nforce2 running 2kpro), linux acpi has been limited to power off. though on the PII's i have the acpi stuff disabled in the kernel (read; not there), since I NEVER, turn them off unless i'm swapping UPS's or moving them. I could put the appropriate module in, but i'm just lazy).
As for my windows machines, uptime = 24/7 where possible, one had an uptime of three weeks before i shut it down when i went away for a weekend (SOP here in florida, given the aged nature of the surge box), the other typically has an uptime of a week (updates and the occasional kernel frag), being that the box goes from home to LAN party every two weeks.
more than ACPI, but the more stuff in a box, the harder it is to shut everything off. I've taken to dividing up what each box actually does, with my game box being stripped down (no parallel, serial or extraneous usb here) just mouse, ps2 keyboard and joystick. with a CD burner and DVD-ROM (2 drives). and a single HD. if i actually wanted to put it to sleep, it'd do it.
the other desktop nix box by it's side has a DVD burner, CF reader, UPS interface, and the like, not so easy to power to sleep.
now my iBook, uptime WOULD be 100% since january if not for the latch going and keeping the lid open in transit (rattling kept the screen on, battery died) and the other time the battery came loose... it ran for 50 days before dying.
same uptime as my best linux server that only goes down when i do something with the power.
Logistical Chaos Officer http://www.slagg.org - LAN Gaming in Sarasota FL,USA
I'm very fond of suspend to disk. Suspend to RAM I don't care for at all.
I prefer to be insensitive to power loss and pay a small penalty in startup time. If I've hibernated a system, I know that if I leave the laptop unplugged too long, or if the PC gets moved and consequently unplugged, I'm fine. I move hardware more often than I'd like. LiveCDs are fun to play with too. Don't lose your state, and pay less of a penalty in boot time.
Long before hibernate was commonly available, I thought that suspend to disk would be a perfect response to power events. Do your servers have enough battery backup? What about if the same power event kills all the stoplights and elevators in your large city? Why not retain the server's state, instead of incurring the cost of a total shutdown and restart? If my laptop battery is about to be drained, I prefer that it go to a state where I can swap batteries or not worry about rushing to a charger.
Assembly is the reverse of disassembly.
This thing is a brick in linux, because of power management.
APM works, sorta. Resume from suspend fails about 30% of the time. 20% of the time, resume works okay, but the system is really slow, and the fan stays on 'high' (really noisy) speed.
ACPI is broken. Battery, buttons, temperature, etc. . . can work, if you use a modified DSDT.
S1,S3 don't work. S1 doesn't resume, S3 doesn't turn the screen backlight off. S4,S4b resume about 60% of the time, but it already takes so long to come back up I might as well do a proper shutdown.
BOOO. I WANT A LINUX LAPTOP THAT GOES INTO S3 or S1 PERFECTLY!@!!!!
PLEASE PLEASE PLEASE!
I know, I know, I should get a powerbook. In fact, I own a powerbook g4 12" DVI. But I lent it to my sister, 'cause her laptop died.
Don't get me wrong, OS X is awesome. intergrated bluetooth rocks. Lots of great things about this laptop.
But I can't install linux on it and have working power management. I like linux. I know my way around linux. I like hacking around on linux.
But on my laptop, I NEED power management.
WhiteWolf666 an exBush supporter. All you new-school,compassionate,save the children Republicans can rot in hell
I want a linux laptop.
Here are my requirements (given that I will be running linux):
1. Must do ACPI suspend, S1+S3
2. Must have a good 3D video card, Radeon 9600/Geforce FX GO 5650 or up.
3. Decent battery life would be nice.
4. Integrated bluetooth+Intergrated 802.11b
Don't tell me to get a powerbook. I have a 12" G4 laptop DVI. I want linux, with suspend. Can't do that on the powerbook. Mac OSX is wonderful. Yes, yes. I want a linux laptop with suspend.
Don't want to do suspend to disk, I want the thing to resume in 5 seconds or less.
A unit that is in the correct price range for me, and meets my other requirements, is the Dell Inspiron 9100. But, does ACPI suspend work on it?
I'm guessing not, since Dell has a horrible record about Linux suspend.
So---HP and Compaq have similar models, in a similar price range (can't remember the model numbers), but remember--- i want a good, fast, opengl card. I believe that each (sorta)company has one system with either a radeon 9600 or a Geforce FX go 5650.
Do those two models suspend correctly?
Anyways, I'm open to suggestions. But I can't afford an Alienware, or a Voodoo Laptop.
If I'm gonna spend 3 grand, I'll get the 17" powerbook.
Ideally, I can spend about $1500, and get what I want. If the Inspiron 9100 suspended correctly, it would fit the bill nicely.
WhiteWolf666 an exBush supporter. All you new-school,compassionate,save the children Republicans can rot in hell
And yes, I was surprised. It's my first computer to ever do this...
If at first you don't succeed, skydiving is not for you
I have ACPI suspend-to-disk working quite nicely on my Dell Inspiron 4000, running Gentoo and 2.6.4-ck2.I've never tried suspend-to-RAM; I'd rather be certain that my batteries won't die while my computer is unattended.
It certainly took a while to get there, especially since I originally attempted to use the Dell/RedHat suspend-to-disk-partition-building tools, which did not work at all, but now I've got it saving to swap and I'm golden.
In fact, I dual-boot Windows XP and Linux on my laptop (for games, you know), and I set up Windows to hibernate with its page file so that I can switch between them with ease. Hibernate one, rouse the other, etc. etc. The only problem I have with that scheme is that my shell replacement in Windows tends to crap out after a few reboots and requires a full restart to repair. The hardware itself is all good, though.
Sleep works perfectly on Debian/PPC running on my Pismo-era Powerbook. I can't remember the last time I had to reboot it -- I just close the lid when its not in use.
Just thought I'd offer a non x86 perspective.
--saint
Of course, this doesn't shut everything down, so it wouldn't be appropriate to put your laptop in its bag and take it to work like this.
It's been more than two and half years since I
bought my laptop computer and from the first
day I was able to suspend to RAM while using W2K.
But unfortunately I do most of my work on Linux,
it is unbelievable but even if I tried hard to
configure ACPI on Linux I haven't yet been able
to use any power saving feature other than halt.
Why does the development of ACPI support on Linux
evolves so slowly?
I will admit to being a screen junkie.
I have half a dozen login sessions on my box at home running under screen for *months* at a time.
I can go to work, ssh to my home box, type "screen -rd" and get back to where I left off at home. The apps continue to run just fine and as they are attached to a pty, xterm resizes (or a re-attach from a different sized xterm) are not a problem. (except for btlaunchmanycurses.py Grrrrr...)
What gets really handy is when you use screen-aware apps like elinks, and you get to use "open link in new window" in a text mode browser.
Yay!
My one word of warning (more than one word actually... more like one point) is that ssh-agent forwarding within screen gets a little weird. Google for "ssh agent screen" to find a method of updating your environment that you like.
Cheers.
John