Blog

A Bit More About Hibernation

Permanent link March 16th, 2008

After my post yesterday about hibernation and secure virtual memory, this TidBits article was brought to my attention. If you set bit 2 in pmset for hibernatemode, your memory will be saved to disk irregardless of wether you have enabled or disabled secure virtual memory. This of course could easily give you the false illusion of having secure virtual memory enabled, whereas it is not treated as such during safe sleep.

The TidBits article explains how bit 2 was a temporary workaround for problems with hibernation and secure virtual memory. It was subsequently removed when those were fixed. Clearly there still is some work left to be done with regards to safe sleep, secure virtual memory and the MacBook.

With this knowledge I have to conclude that the problem is not so much caused by a wrong setting for the hibernatemode as I expected before, but in the way secure virtual memory gets dealt with.

My advice for MacBook owners stays the same though: disable secure virtual memory. The drawback is obviously the risk of people snooping through your virtual memory, but in my opinion that does not outweigh the benefit of having ones work preserved when the battery goes empty.

I purposely did not explain how to change the hibernatemode in pmset (to 7 for example). Unchecking the secure virtual memory checkbox is in my eyes for now the best workaround for the sudden shutdown problem with MacBooks.

Update: As mindsnare shares with us in the comments, you might need to also zap your PRAM in order for the problem to be fixed.

7 comments to “A Bit More About Hibernation”

  1. mindsnare:

    Unchecking the secure virtual memory checkbox doesn’t seem to be enough. The described problem persists on my machine, a MB 2.0GHZ Core Duo with a brandnew battery, replaced by the Apple battery quality program.

    Anything else I have to do than unchecking the checkbox for the svm in the security prefpane?

  2. Johan Kool:

    Sorry to hear that this does not work for you. You did restart after turning off secure virtual memory?

    It has been working for me consistently. It might be that there is another problem with the same symptoms. Sorry if this doesn’t help in your case…

  3. mindsnare:

    I rebooted of course after truning off the secure memory.

    The battery Apple sent me 2 weeks ago was new, now it has 10 cycles and it lasts 4,5h easily. However it seems to be from November 2007, Hardware Monitor stated…

    I would be happy with it, but the MB doesnt sleep at all with this battery. In fact it seems to write the sleepimage as it should, then powers off. No flashing light that would indicate sleep mode. When I wake it up (have to plug it in of course) then it tries to read the sleepimage I think, 3-4 seconds, then the MB decides to better reboot. As if the sleepimage couldnt be read and thus the previous status cant be restored. I suspect the sleepimage is being written incomplete…

    Maybe calibrating would help, but I dont know how since the MB overrides any sleep mode and goes straiight to deep sleep, from where it wont awake correctly, ending up with a reboot.

    The system is as clean as it can be, I re-installed Leopard a few days after receivig the new battery.

  4. Johan Kool:

    Did you have this problem with your old battery as well, or did it only surface after you got your new battery? (Just to be sure, as I cannot tell from your comments what the reason was for getting the new battery.)

    Your symptoms sound exactly like mine. I can only tell you that turning of secure virtual memory was successful for me. I am not sure what else could help you.

    Calibration seems impossible indeed when you get a sudden shutdown like this. How much percentage does it say it still have when it shutdowns? If that is say 0-5% I would say no calibration is needed.

  5. mindsnare:

    With the old battery the MB would occcasionally should down instead of sleeping as well (but not always, like I have it with the new battery now). It had 100 somewhat cycles and the health was 50%. The MB qualified for the battery replacement program so I got a new one. Since that I never saw my MB sleep correctly anymore…

    The new battery seems to be healthy, and I am happy with the time it lasts, but something prevents the MB from the normal sleepmode. I get the low level warning, when the battery shows about 9 min left. All looks fine until then but the MB doesnt fall sleep, but powers off.

  6. mindsnare:

    I have some news on this. After the last shut down I desperately reset the PRAM (4 gongs), and in the very next cycle the MB just fell asleep nicely. I waited 6 or 7 hours, hoping the battery would calibrate. Seems hibernation worked as advertised as the MB came back to life without reboot.

    The next cycle worked exactly the same. Sleep mode worked and hibernation as well. I am starting to think that the shutdowns may be gone for my machine.

    So basically all I did was to turn off the secure virtual memory and zap the PRAM.

  7. Johan Kool:

    Glad to hear it did work for you after all mindsnare! I’ll add the zapping PRAM bit to the main text in case anybody else runs into your situation as well.

Leave a Comment