In this state it will immediately write the contents of memory to a swapfile on the solid state storage - by default to /var/vm/sleepimage. My theory is that there is a race condition with Filevault that may corrupt the memory image whilst both processes try to do their stuff on the storage. When the MacBook is plugged into a power source and the power button is pressed, the backlight lights but the screen stays black. I can see the backlight through the Apple logo on the lid. It stays in this state forever and needs to be hard reset by holding power for 10 seconds, releasing and pressing it again to switch the computer back on.
I actually brought the MacBook Air back to the Apple Store and got a replacement which exhibits the same problem, so with the second one I did a little bit of experimentation to narrow down on the root cause. I did the following -
- A complete Lion clean install (Command-R at bootup).
- Let the battery run dry, MacBook Air hibernates and wakes successfully after applying power.
- Applied Filevault.
- Let the battery run dry, MacBook Air hibernates and crashes on wake after applying power.
- Reset both PRAM and the SMC - neither helped.
The Workaround
To work around this until Apple (hopefully) fix what is quite a glaring problem (happened on 2 MacBook Airs for me) it is possible to turn off hibernation. This means that the machine will only sleep - contents of memory remain in RAM which remains powered for as long as the battery holds up. Remember, this differs from "SafeSleep" or hibernate - it persists memory to flash storage so that even if the battery runs out, the memory image can be restored and you can just carry on with your work.- First off, check your existing hibernate mode (it will usually be 3 - the default)
sudo pmset -g | grep hibernatemode
Password: <enter password>
hibernatemode 3
- Look at the man page for pmset to see the valid hibernate modes -
man pmset
The relevant part -
We do not recommend modifying hibernation settings. Any changes you make are not supported. If you choose to do so anyway, we recommend using one of these three settings. For your sake and mine, please don't use anything other 0, 3, or 25.
hibernatemode = 0 (binary 0000) by default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.
hibernatemode = 3 (binary 0011) by default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.
hibernatemode = 25 (binary 0001 1001) is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.
- The crash happens for both hibernatemode 3 and 25 (I've tested both). To set hibernatemode to 0 (i.e. turn it off) use the following command -
sudo pmset -a hibernatemode 0
- And to switch it back to the default -
sudo pmset -a hibernatemode 3
As a side effect of this change it is possible to remove the safe sleep image (which is exactly the size of the memory on your MacBook Air) as obviously Lion won't write to it with hibernation turned off -
sudo rm /var/vm/sleepimage
All these steps at your own risk, but it works for me. Other posts on this topic can be found here -
Apple Discussion 1
Apple Discussion 2
UPDATE Should have mentioned that this testing was done on Mac OS X Version 10.7.1 and I've tested hibernatemode 3 on 10.7.2 and see the same behaviour - so no bug fix yet :(
UPDATE Bug filed at the Apple Bug Reporter (#10288882)
UPDATE Macbook Air EFI 2.3 fixed this issue for me!