Problem with applications not resuming where left off after low-battery sleep/hibernate on Lion

I am having problems with applications re-launching from scratch, rather than continuing where they left off, when resuming my Mac (alumimum MacBook, fall 2008) after its battery runs low. This results in losing any unsaved work and very slow resume times. How can I prevent this?

This problem only appeared during the past few months after I upgraded to Lion. I am now running Lion (10.7.3)

In the past (Snow Leopard), after the battery ran low/out, the computer would keep track of the state of all open applications and the computer was plugged in and resumed (power key). No data was lost and I was able to get right back to work.

But now, when the battery runs out, most/all of the previously running programs relaunch from scratch. For browsers (Chrome/Firefox) this means bringing up an error page and asking if I'd like to restore the session. Microsoft Office products splash screens re-appear and I am prompted to recover files from backups. Terminal starts a new session with old results greyed out. LyX attempts to load backup files. MATLAB splash screen re-appears and I lose all unsaved data. Etc.

Visually the resume process is also different: Rather than showing a greyed out version of the desktop as I left it with a progress bar, I now get a generic login screen with the grey tweed background. However, it does not behave as though I had manually forced a power off since a) rEFIt doesn't prompt for Mac vs Windows and b) All applications that were previously running start again, rather than only the default login set.

Additional information:

  • pmset -g custom shows that all power modes are using the default hibernatemode 3 where the system state is both written to disk and kept in memory as long as the battery power allows.
  • Battery is in the "Replace Soon condition"
  • Harddisk is fairly full 27/285GB free
  • 4GB of RAM

My best guess is that my battery runs out before OS X has a chance to finish saving the full memory image to disk. I often run lots of memory intensive programs and use all of the system memory (4GB) plus ~8GB of swap. How can I tell if this is the problem? And if it is, what can I change so that OS X has enough time to save a full memory image before the battery runs out?

Any thoughts on how to enable a robust sleep when the battery runs out?


As you noted from the system profiler, your battery is close to getting ready to fail.

Battery is in the "Replace Soon condition"

Your best guess is accurate in that the "battery runs out before OS X has a chance to finish saving the full memory image to disk" This memory image is used to enable Safe Sleep. Without it, applications start from scratch.

A thing to try before replacing the battery is to attempt to calibrate the battery.

Calibrating MacBook Battery

PowerBook G4 (15-inch Double-Layer SD), MacBook (all models), and MacBook Pro (all models)

The battery calibration for the PowerBook G4 (15-inch Double-Layer SD) and any model of MacBook or MacBook Pro has been updated because of a new battery released with this computer. With these computers, follow these steps to calibrate your battery:

  1. Plug in the power adapter and fully charge your PowerBook's battery until the light ring or LED on the power adapter plug changes to green and the onscreen meter in the menu bar indicates that the battery is fully charged.

  2. Allow the battery to rest in the fully charged state for at least two hours. You may use your computer during this time as long as the adapter is plugged in.

  3. Disconnect the power adapter while the computer still on and start running the computer off battery power. You may use your computer during this time. When your battery gets low, the low battery warning dialog appears on the screen.

  4. At this point, save your work. Continue to use your computer; when the battery gets very low, the computer will automatically go to sleep.

  5. Turn off the computer or allow it to sleep for five hours or more. Connect the power adapter and leave it connected until the battery is fully charged again.

Tip: When the battery reaches "empty", the computer is forced into sleep mode. The battery actually keeps back a reserve beyond "empty", to maintain the computer in sleep for a period of time. Once the battery is truly exhausted, the computer is forced to shut down. At this point, with the safe sleep function introduced in the PowerBook G4 (15-inch Double-Layer SD) computers, the computer's memory contents have been saved to the hard drive. When power is restored, the computer returns itself to its pre-sleep state using the safe sleep image on the hard drive.

If your computer continues powering off completely in-between steps 4 and 5 after a couple of trys, replacing your battery may be the only way to reliably get the safe sleep functionality back, other wise you may need to manually configure your MacBook to go into Safe Sleep when you put it to sleep manually well before the hard power-off occurs. A Utility such as SmartSleep might help greatly.