MacBook – Can’t hibernate computer MacOS Mojave, no pmset “standby” option

hibernatemacbook propowerpower-managementsleep-wake

I have a Mid-2009 Macbook Pro 17 inch (5,2), with MacOS Mojave 10.14 installed. I want to enable hibernation (or standby, or deep sleep, or safe sleep) in order to power off the RAM when in sleep mode.

I have tried

sudo pmset -a hibernatemode 25

but my computer still wakes up instantly from sleep, meaning it's not hibernating to disk.

I have read here that the options autopoweroff and standby are relevant, but pmset -g does not show those options for my computer:

System-wide power settings:
Currently in use:
 womp                 1
 autorestart          0
 halfdim              1
 sms                  1
 hibernatefile        /var/vm/sleepimage
 gpuswitch            2
 networkoversleep     0
 disksleep            1
 sleep                0
 hibernatemode        25
 ttyskeepawake        0
 displaysleep         1
 acwake               0
 lidwake              0

man pmset says,

standby causes kernel power management to automatically hibernate a machine after it
has slept for a specified time period. This saves power while asleep.  This setting
defaults to ON for supported hardware. The setting standby will be visible in pmset
-g if the feature is supported on this machine.

and

autopoweroff is enabled by default on supported platforms as an implementation of Lot
 6 to the European Energy-related Products Directive. After sleeping for
 <autopoweroffdelay> seconds, the system will write a hibernation image and go into a
 lower power chipset sleep. Wakeups from this state will take longer than wakeups from
 regular sleep.

It seems then that standby is not supported on my model, so should be irrelevant. Also, autopoweroff only applies to when AC is attached, but I can't hibernate when on battery either.

Why is my laptop unable to hibernate? I'm sure I've had it hibernating in previous versions of MacOS.

I have also reset my SMC and NVRAM, still the same problem.

Output of pmset -g assertions:

 2018-09-25 22:17:33 -0700 
 Assertion status system-wide:
    BackgroundTask                 0
    ApplePushServiceTask           0
    UserIsActive                   1
    PreventUserIdleDisplaySleep    0
    PreventSystemSleep             0
    ExternalMedia                  0
    PreventUserIdleSystemSleep     0
    NetworkClientActive            0
 Listed by owning process:
    pid 111(hidd): [0x0000030000098140] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294968067.3" 
     Timeout will fire in 120 secs Action=TimeoutActionRelease
 No kernel assertions.
 Idle sleep preventers: IODisplayWrangler

EDIT 1:

I have a new suspicion about this, which is that I upgraded my RAM on this machine from 2 2GB RAM cartridges to 2 4GB RAM cartridges, however, /var/vm/sleepimage is 4294967296 bytes, so can't hold all of the data in my RAM. What I've tried with regard to this:

1 ) deleting /var/vm/sleepimage, restarting, sleeping. The OS recreates it at the same size.

2 ) running mkfile 9G biggersleepimage, placing it at /var/vm/biggersleepimage, running chown root:wheel and chmod +t biggersleepimage, then running pmset hibernatefile /var/vm/biggersleepimage. In this case, the file gets resized to 4294967296 bytes after the last command!

3 ) rifling through logs and reading man pmset and googling a bunch.

I happened to have my old RAM cartridges hanging around, so I popped those in to see if that would fix it, but it still won't hibernate. (I didn't try resetting NVRAM and SMC with the old RAM in though)

EDIT 2 (progress?):

I moved the sleepimage to my secondary disk and it hibernated! but then it wasn't able to wake up. I have two disks in this computer: a SSD connected to where the DVD drive used to be (This is my system disk) and an HDD where the original system disk used to be. Using mkfile 4G /Volumes/Data/sleepimage; pmset hibernatefile /Volumes/Data/sleepimage then hitting sleep got my computer to hibernate! but then when trying to resume, it hung on a grey screen until I gave up and turned it off and on – it then bootlooped once and started up from scratch.

EDIT 3:
Amazing! I swapped the locations of my SSD and HDD and moved the hibernateimage back to the SSD and put the old RAM in and now it successfully hibernates and resumes! gonna try now with the new RAM

EDIT 4:
With 8GB of RAM and 5GB used before I tell my computer to sleep, and ls -l /var/vm/sleepimage still shows 4294967296 bytes, I can successfully hibernate and resume! It seems the problem was that my system drive was in the wrong bay.

Best Answer

In my case, I had added a SSD to my machine, which I put in the old DVD SATA slot. This is my main system disk, with an HDD in the original hard drive slot for additional storage. It seems that macos can only resume from a harddrive in the original SATA slot. Swapping the two drives fixes the problem for me!