3

I have a Late 2008 MacBook Pro, that runs only on charger (wall power), because the battery died a long time ago. With battery it used to be able to hibernate to disk, but it seems like I can not get that feature to work now, because the battery level never gets low enough to trigger the hibernation to disk - there is no battery.

I want to be able to close the lid and for the system to get into safe state, where I can remove the charger and later restore my work from were I left off, when I plug it in again.

After reading How to add hibernate mode to MacBook Pro and it seems like my only option is to switch to hibernatemode 25. This is quite old model so it does not support standby and autopoweroff:

$ sudo pmset -g
System-wide power settings:
Currently in use:
 womp                 1
 Sleep On Power Button 1
 halfdim              1
 autorestart          0
 hibernatefile        /var/vm/sleepimage
 gpuswitch            2
 sms                  1
 networkoversleep     0
 disksleep            10
 sleep                0
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         15
 acwake               0
 lidwake              1

Is there a combination of settings that maintains the system state in memory but also always hibernates to disk that works on this model?

Palimondo
  • 223
  • 1
  • 2
  • 9
  • 1
    What version of macOS are you running? As an aside, you can still buy a replacement battery for this model and, assuming all else is fine with it, that's what I would do. – Monomeeth Apr 04 '17 at 10:07
  • hibernatemode 3 does exactly what you describe. Look at man pmset – Allan Apr 04 '17 at 12:05
  • @Allan As you can see, it is set to hibernatemode 3, but the problem is that when I remove the charger while it is sleeping and reconnect it again, it doesn’t resume from sleep - it just restarts after a brief failed attempt at resuming. – Palimondo Apr 05 '17 at 11:37
  • @Monomeeth Sierra with patch for old macs. Why does it matter? I had same issue on El Captain. – Palimondo Apr 05 '17 at 11:39
  • Are you allowing it time to write the sleep image to disk before unplugging? See this video – Allan Apr 05 '17 at 11:41
  • @Allan Yep. I wait until the indicator pulses. It just doesn’t resume correctly. I think it has something to do with having no battery and being on a charger when it goes to sleep. – Palimondo Apr 05 '17 at 11:45
  • 1
    3 does exactly what you describe is happening - from the answer you quoted. "The system will wake from memory, unless a power loss forces it to restore from disk image." So a power loss will force a reboot. Have you tried setting to 25? I am unclear what you are asking. If you remove power in your case you are suffering a power loss so how do you expect data to be in memory? – mmmmmm Apr 05 '17 at 12:22
  • 1
    Have you tried deleting the existing sleepimage file (or setting a new one)? Just call it something else. – Allan Apr 05 '17 at 14:28
  • @Palimondo The reason your version of OS matters is that different versions provide different options for configuring hardware settings etc, and from your question we had no idea whether you were running Mac OS X Leopard or the last officially supported OS, El Capitan. And of course, asking this has revealed you're actually running an officially unsupported OS in macOS Sierra. These factors are all relevant to your question. Unfortunately, after re-reading your question and the various questions/answers in comments, it seems to me that you may misunderstand how hibernation works. – Monomeeth Apr 05 '17 at 22:13
  • 1
    In your question you state because the battery level never gets low enough to trigger the hibernation to disk, however, the act of hibernation actually requires power. One of the advantages of hibernation is that it uses less power than sleep mode does, but it does still require and use some power. So it's not that your battery level never gets low enough to trigger the hibernation to disk, it's that it's never high enough for that to happen in the first place before having to conserve power. In a nutshell, @Mark is totally correct. – Monomeeth Apr 05 '17 at 22:13
  • 1
    @Allan Yay! It must have been a corrupted sleep image. I’ve deleted it and now all works as it should. – Palimondo Apr 06 '17 at 13:33
  • @Monomeeth: You can hibernate a PC with a dead battery or no battery just fine. The power is needed to hibernate and to wake up but is not needed while hibernated. – hippietrail Aug 17 '17 at 02:05
  • @Allan: How do you delete the sleepimage? I couldn't using rm even with sudo. It just gave the error rm: /var/vm/sleepimage: Operation not permitted – hippietrail Aug 17 '17 at 02:09
  • 1
    @hippietrail - Disable sleep completely, reboot, then try to delete. It won't delete if the file is open/active. You can also try using the -f flag to force the deletion. – Allan Aug 17 '17 at 02:20
  • @Allan: Forgive my ignorance, but how do I disable sleep completely? I don't see such an option in Energy Saver... Actually with sudo and -f I could delete it anyway. Let's see if this fixes it ... – hippietrail Aug 17 '17 at 02:31
  • 1
    @hippietrail In Terminal - sudo pmset sleep 0. If you type sudo pmset -g, it will show you all the settings that are currently configured. 0 is disabled, any value greater than 0 is the number of minutes. – Allan Aug 17 '17 at 02:35
  • It turned out that deleting the sleepimage didn't solve the problem for me. The difference in my case is that my boot drive is an external HD since the SDD is missing. I asked a new question about my specific case too: https://apple.stackexchange.com/questions/295438 – hippietrail Aug 17 '17 at 02:45

1 Answers1

2

It turns out that my sleep image was somehow corrupted and system couldn’t boot from it correctly. After I’ve deleted it, all started working fine again: closing the lid and waiting for the light indicator to start pulsing, disconnected charger, connected it again and system restored from disk just fine.

Previously, I was been able to work around this issue by using DeepSleep utility, that was recommended as alternative approach on How to Hibernate a Mac.

When I want to unplug my MacBook from power I use DeepSleep to hibernate to disk. The resume then works the same like I remember it from when I had a battery in my machine. ¯\_(ツ)_/¯

Allan
  • 101,432
Palimondo
  • 223
  • 1
  • 2
  • 9
  • I'm glad you found a workaround and have upvoted your question and answer as I'm sure the DeepSleep utility will help others as well. However, just wanted to state again that if it were me I'd buy a replacement battery. This particular model of MBP was one of the better ones, so if it's still working well, it'd be worth the investment. I've also added hybrid/fusion drives to this model and they function brilliantly. As a final aside, how well do you find that macOS Sierra works on it? – Monomeeth Apr 05 '17 at 22:23
  • 1
    Glad I could point you in the right direction. I agree with @Monomeeth that you should replace the battery. They are only $30-$40 on Amazon so it's a very inexpensive fix. – Allan Apr 06 '17 at 13:45
  • How did you delete it? I couldn't using rm even with sudo. It just gave the error rm: /var/vm/sleepimage: Operation not permitted – hippietrail Aug 17 '17 at 02:11
  • @Monomeeth Sorry for the delayed response! I had the right network chip so everything in Sierra is working fine with the patch mentioned above. – Palimondo Aug 18 '17 at 05:27
  • 1
    @hippietrail You have to force it: sudo rm -f /var/vm/sleepimage – Palimondo Sep 02 '17 at 00:54
  • @Palimondo: Yes I did work this out and deleted the sleep image but I could still not hibernate the Mac. When it went to sleep with all lights out if I unplugged the external drive it would always wake up and crash, no matter how long I left it before doing so. – hippietrail Sep 02 '17 at 01:25