Contribute
Register

Is hibernation supported?

Status
Not open for further replies.

awb

Joined
Nov 8, 2012
Messages
2
Motherboard
Gigabyte GA-Z77X-UP5 TH
CPU
i7-3770K
Graphics
GTX 770
Is hibernation supported? And if not, will support for it return?

There seems to be a lot of interest in this question. Perhaps one of our resident experts on all things Clover can weigh in on this in a thread specifically dedicated to it.

I have seen a lot of conflicting statements about this. The newer posts seem to suggest not. Many users are reporting that it worked until updating to 10.12, and then no longer. At the very least, the general consensus is to disable it. However, hibernation detection is clearly built into Clover, along with code and behavior that suggests it is capable of resuming from this state. Most hackintoshes with proper power management can enter into hibernation and write a sleepimage file.

This file exists in the Clover repository on SourceForge:
rEFIt_UEFI/Platform/Hibernate.c
Note: My preboot.log contains debugging logs from this file.

This is in the Clover change log:
"Revision 2525 - hibernation"

Moreover, wake time is one of hibernation's main benefits. If hibernation is not in the cards, I'm sure many besides me would like to know how boot time can be reduced, other than setting Clover's timeout to 0. What portions of the boot process take the longest time? Are there other Clover settings that can make a noticeable difference? Are there unnecessary steps in the boot process that can be set to skip, e.g. the check for an encrypted disk, for those of us not using one? Are there ways to reduce macOS's timeouts during the boot process? Any tips that might serve to reduce boot time in the absence of hibernation would be helpful.

Hibernation is a pretty basic function, and it seems to be in pretty high demand. If it is indeed broken, then it's just one more thing that a genuine Mac has over us. Something tells me we won't allow that forever...are there plans to address this and restore functionality?

I am including my own issue below, but I am separating it since I know many other people would like a definitive answer to the main question and related issues above. Also, if hibernation is not supported, then what follows is largely irrelevant, though it may have to do with why it is nonfunctional.

-------------------------------

I would really like to get hibernation working on one of my systems. It is used very much like a laptop, with an uninterruptible power supply that is often on battery power. Boot/wake time also happens to be critical for its purposes, and though sleep is working just fine, it doesn't last more than a day or two on ~12Ah of battery life.

The system in question:
Intel NUC7i5 (Kaby Lake i5-7260U)
16GB 2133MHz DDR4 RAM
Samsung 960 Pro
High Sierra Beta, Clover_v2.4k_r4200 (UEFI boot)
iMac14,2 system definition
No MultiBeast, post-installation done following RehabMan's NUCi7 installation guide, but adapted for High Sierra (e.g. no HackrNVMeFamily, no SSDT_NVMe or SSDT-SkylakeSpoof)

Clover does not recognize that the system has been hibernated, and it is logging a "Not Found" error when attempting to open sleepimage. Clover is installed to the EFI partition on the 960 Pro, and there are no other drives. The sleepimage file is in the default location and is being created upon entering hibernation with hibernatemode 25. Clover is looking to that location, according to the preboot.log:
0:428 0:005 Check if volume Is Hibernated:
0:428 0:000 Check sleep image 'by signature':
0:429 0:000 using default sleep image name = \private\var\vm\sleepimage
0:429 0:000 sleepimage not found -> Not Found
0:429 0:000 hibernated: no - sign
...
0:476 0:008 Check if volume Is Hibernated:
0:476 0:000 Check sleep image 'by signature':
0:491 0:014 read prefs \Library\Preferences\com.apple.PowerManagement.plist status=Success
0:491 0:000 using default sleep image name = \private\var\vm\sleepimage
0:497 0:006 sleepimage not found -> Not Found
0:497 0:000 hibernated: no - sign

This suggests that in Clover's "Hibernate.c", in the "GetSleepImagePosition" function, the "ImageVolume->RootDir->Open" command is failing to find the sleepimage file, even though it is being passed the correct path. Both times, it is called by IsSleepImageValidBySignature().
The function call in question (currently at line 438 of Hibernate.c):
if (ImageVolume->RootDir) {
// Open sleepimage
Status = ImageVolume->RootDir->Open(ImageVolume->RootDir, &File, ImageName, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR(Status)) {
DBG(" sleepimage not found -> %r\n", Status);
return 0;
}
}

Why might this be happening? Is this error specific to my hardware, or are other people getting the same results in their Clover logs after attempting to hibernate? Could this be because the drive in question is NVMe (i.e. might I have better luck using an AHCI SM951 instead)? Could this be because the drive is formatted APFS for High Sierra, and Clover isn't reading it natively? I am using the apfs.efi driver from the 10.13 beta, but Clover loads that driver long before doing the hibernate check, and it can detect and boot the OS without issue. Will failure inevitably occur further along in the resume-from-hibernation process anyway?

Thanks to anyone who can offer any suggestions or shed some light on these topics.
 
Last edited:
I'm sure many besides me would like to know how boot time can be reduced, other than setting Clover's timeout to 0. What portions of the boot process take the longest time? Are there other Clover settings that can make a noticeable difference? Are there unnecessary steps in the boot process that can be set to skip, e.g. the check for an encrypted disk, for those of us not using one? Are there ways to reduce macOS's timeouts during the boot process?

I remember actually using a terminal command to permanently turn OFF Hibernation (several years ago mind you, I can't remember what I typed...) It was taking too long to write its file and I didn't need it anyway. But I am always looking for ways to speed up the boot times. This part of your post is of interest to me so I will be monitoring what answers pop up here.

I recently changed my system from a Z77 based to a Hero IX (270) based system and the boot times are the SAME! I thought that it would be faster...
 
In Clover 4223 there are hibernate fixes, this fixed my hibernate problem (but unfortunately not the one with the bluetooth card)
 
I'd be interested in seeing this thread revived. My Hack, now running 10.13.2, clearly writes a sleepimage file, but Clover (4369) doesn't recognize that it's there (APFS on the SSD). Like others, hibernate worked perfectly through 10.11.6 but hasn't since. I don't mind the write time being longer (if sent to a spinning disk, as I did with 10.11.6, for increased lifetime of media), because wake is still faster than a cold boot and having to reenter credentials for password keeper and mail client.
 
I deliberately turned off hibernation. Here are the reasons in brief:
Check the size of the sleepimage file in the /var/vm folder, you will notice it is huge, many GB's.
A new file is generated each time macOS enters hibernation.
Trim, if working properly, will gradually ready the space used by the old unused sleepimage and return that recovered space back to the controller, so it can be used again. Just think what happens if trim is NOT WORKING :) or has been deliberately turned off because of problems with their hacks with trim enabled :)
Now compute, say over the period of a week, how many times hibernate state is entered, multiply that by the size of your regular sleepimage file and you will find that you arrive at an astronomical figure, not in bytes but rather terrabytes. That is just for generating the file. What about trim having to clean the same amount of unusable space, occupied by the old sleepimage files, before that space is again available to the SSD controller, and consequently to the operating system.
Do you really want your SSD to work itself to an early death ?, besides the generation of the sleepimage file also takes time
when the machine enters sleep in hibernation mode.
For me, for the reasons above, it remains permanently off, and that is it.
Hack wisely!
 
hibernation may be evil for a SSD or not, but nobody answered the OP question if it is indeed supported or planned to be fixed in upcoming versions, after his very elaborate post. I am also curious about that. In my case, sleepimage is also generated but hibernated state not shown in Clover.
 
I'd be interested in seeing this thread revived. My Hack, now running 10.13.2, clearly writes a sleepimage file, but Clover (4369) doesn't recognize that it's there (APFS on the SSD).
I'm also using APFS on a SSD. just curious if you are using TRIM.
 
Is hibernation supported? And if not, will support for it return?

There seems to be a lot of interest in this question. Perhaps one of our resident experts on all things Clover can weigh in on this in a thread specifically dedicated to it.

@awb,

The main problem with Hibernation is that the hibernation file is encrypted and the decrypt key is normally stored in a Mac's extended SMC/RTC memory. Normal PC's usually only have a very small amount of SMC/RTC Memory and FakeSMC does not emulate it.

However there is a new Lilu plugin that can enable Hibernation support, from my understanding it is dependant on you system having hardware NVRAM (not emulated). The Lilu HibernationFixUp plugin detects when the system is entering hibernation and stores the decryption key in NVRAM. It seems that currently the MacOS Boot Loader will fall back to NVRAM if it does not find the decryption key in the Macs SMC/RTC memory which allows this fix to work.

More info and release downloads can be found in the projects Git-Hub page :-

https://github.com/acidanthera/HibernationFixup

I have not tried it myself so cant comment on how well it works .... but most Lilu plugins work very well as long as they are installed configured correctly.

My only reservation with this method is that it would appear to rely on the NVRAM fall back in the MacOS Boot Loader ... I suspect this is some legacy method that very old Macs may have used, as such it's something that Apple Could remove if they decide to tighten security in future releases of MacOS ... especially with the news of a new cold boot attack that effects most computers.

Cheers
Jay
 
Last edited:
I'm honestly surprised it's 2019 now and the simple issue still hasn't been resolved. It's been mentioned countless times on sourceforge under Hibernate.c and many forums and no one seems to give a f. Slice clearly noticed it but he seems to have left it unresolved.

For future reference I'm on Cataline beta with the latest Clover and the same error occured. Exactly the same as what it was 3 years ago, smh.

Attached Log:

0:905 0:059 === [ ScanLoader ] ========================================
0:905 0:000 - [01]: 'EFI'
0:984 0:079 AddLoaderEntry for Volume Name=EFI
0:984 0:000 skipped because entry is hidden
0:984 0:000 - [03]: 'Preboot', hidden
0:984 0:000 - [04]: 'Macintosh HD - Data'
1:035 0:050 - [05]: 'Recovery'
1:035 0:000 AddLoaderEntry for Volume Name=Recovery
1:092 0:056 - [06]: 'VM', hidden
1:092 0:000 - [07]: 'Macintosh HD'
1:112 0:020 AddLoaderEntry for Volume Name=Macintosh HD
1:117 0:004 Check if volume Is Hibernated:
1:117 0:000 Check sleep image 'by signature':
1:118 0:001 using default sleep image name = \private\var\vm\sleepimage
1:118 0:000 sleepimage not found -> Not Found
1:118 0:000 hibernated: no - sign
1:121 0:003 [!] Icon 18 (icons\vol_internal_apfs.icns) not found (path: EFI\CLOVER\themes\Minimalism)
 
Agreeing what IIIJQIII has said. For me, hibernation does not work in the very same manner. I have loaded HibernationFixup.kext but Clover is unable to find and read the sleep image. My boot volume is APFS.

Happy to test any patches.
 
Status
Not open for further replies.
Back
Top