Jump to content

Sleep, Hibernation - How it works? and How to use?

sleep hibernation

  • Please log in to reply
2 replies to this topic

#1
Allan

Allan

    V.I.P. Member

  • Supervisors
  • 10,415 posts
  • Gender:Male
  • Location:Brazil

*
POPULAR

As many know, those have come from world Windows/Linux, Hibernate mode has helped a lot when we want to avoid the wear on our notebooks, besides which the system always wakes up faster, and we can still leave some open applications when we turn to the PC with all the things ready.

 

The safe sleep/hibernation mode in OS X is turned on by default (on Laptops).

 

Your Mac will immediately sleep when you do any of the following, regardless of your Energy Saver preference settings:

  • Choose Sleep from the Apple () menu
  • Click Sleep after pressing the power key
  • Close the lid of a portable Mac

What happens when the Mac goes to sleep (not just into idle mode or display sleep)?

On all Macs:

  • The microprocessor goes into a low-power mode
  • Video output is turned off, and a connected display may turn off or enter its own idle state
  • Apple-supplied hard disks spin down; third-party hard disks may spin down

On portable Macs:

  • The Ethernet port turns off, if applicable (see note below)
  • Expansion card slots turn off
  • The built-in modem, if present, turns off (see note below)
  • An AirPort card, if present, turns off (see note below)
  • The USB ports only responds to the power key on an external keyboard (see below)
  • The optical media drive, if present, spins down
  • Audio input and output turns off
  • Keyboard illumination, if a feature of your portable computer, turns off

A computer uses considerably less power when in sleep mode than when awake. The computer will continue to power RAM in sleep mode, so that whatever was in RAM when the computer went to sleep will still be there when the computer wakes. This also means that computers with more RAM use slightly more power in sleep mode.

 

For Sleep/Hibernation works in Hack you will need certificate if all necessary patches is already applied in DSDT and SSDT.

And the power management (i.e. CPUPM, GPUPM, HDD/SDD) your bootloader Chameleon/Clover are all correct, Sleep will work. 

 

Hibernate 

 

Now we know how sleep works, let's go for Hibernate. 

As I said the safe sleep/hibernation mode is native only in Apple's Laptops, so if you have a Laptop this trick will be good for you.

 

You can also enable Hibernation Mode for your Desktop Hackintosh, but is not so useful as it is for Laptops.

 

What do you need? 

 

Notes: 

In this article, "Mac Laptop" refers to the Mac with integrated monitor and keyboard as the MacBook or MacBook Pro 

 

Since version 2514 the Sleep/Wake function is working. 

Hibernate mode works natively in Legacy, but you can also use UEFI. 

Works from OS X 10.9.1 up. (Does not work with OS X 10.9.0) 

Don’t work with Chameleon.

We have news that there is success in UEFI mode with OS X 10.7.5, if you work with another version, let us know if you test. 

This guide worked for me in version 10.9.2/3/4 and OS X 10.10.x

 

 

Let's make this method with Clover installed in the root, Legacy 

 

1 - Last version of Clover installed - Download here. [It is recommended to do this using version 2513 or latest]

 

2 - Find out which method is being using in your Hack, with this command:

pmset -g | grep hibernatemode

3 - To Hibernate mode to operate properly, run this in Terminal:

sudo pmset -a hibernatemode 29

4 - Put your OS X to Sleep, after 1 minute your system will shut down completely.

5 - Press the (On/Off) power button

6 - Now the boot screen of Clover (GUI) will appear - Note that this must be written (Hibernated)

 

uTP0ejp.png

 

7 - If you put your system to start with countdown (e.g: 5 secs, 10 secs) do nothing, the system will start in Hibernate mode. 

8 - But if you have no countdown, press ENTER on the partition that you have enabled the Hibernate. 

9 - Now this loading screen will appear, about 10 seconds.

 

DkpMokr.png

 

And Voila! Go your login screen appears, enter your password (if any) and ready, Hibernate mode works. 

 

10 - If you want to start in normal mode, or if you have a problem, check in Clover (GUI) screen and press SPACE, and select "Cancel hibernate wake." 

But if you still have problems, run this in Terminal:

sudo pmset -a hibernatemode 0

With this command, the Sleep mode back to native way.

 

LC1tFu7.png

 

Let's make this method with Clover UEFI. 

 

 

Follow steps 1-5. (Above) 

Understand my friends to work in UEFI mode is not easy, requires several, yes several tests. 

 

See an example of the user droplets (ProjectOSX forum) ,similar to mine, but with different configurations:

 

User @droplets - UEFIClover2620.

Asus N53SV - ML-10.8.4 on SSD , Win7 on HDD.
Hibernation works. Slide=100, hibernatemode=57, OsxAptioFix2Drv.efi, without EmuVariableUefi.

 

 

On my machine works like this: 

Version of Clover: 3368. 

Lenovo G480 - OS X 10.9 /10.10 and 10.11

Boot args used: Slide = 100 

Hibernate: Used hibernatemode = 29

Drivers64 UEFI: DataHubDxe-64.efi, FSInject-64.efi, HFSPlus.efi, OsxFatBinaryDrv-64.efi, EmuVariableUefi, OsxAptioFix2Drv-64.efi.

 

In some cases, OsxAptioFix2Drv-64.efi or OsxAptioFixDrv-64.efi can be a problem, so remove this driver.

 

But maybe someone has any doubts: Can I use these same drivers you used? 

Answer: Yes and No, why? See when using the UEFI mode, each driver that is important for the required loading of various BIOS (Gigabyte, H20 Insyde etc...). See which combination is right for you: Choosing EFI drivers

 

And these various values boot args?

This is what you will test later.

I've tried many values, these were the ones that have given me the best results.

 

And now, how do we know if it works? 

 

1 - The phrase (hibernated) must appear on the boot screen, and show the loading bar.

 

2 - Let marked on your config.plist this option:

Attached File  Screen Shot 2015-11-12 at 10.20.14.png   11.57KB   57 downloads

 

After the system came back, go EFI> CLOVER> misc, and open the debug.log file, and check these lines:

32:460 0:032 PrepareHibernation:
32:580 0:119 read prefs \Library\Preferences\SystemConfiguration\com.apple.PowerManagement.plist status=Success
32:597 0:017 SleepImage name from pref = \private\var\vm\sleepimage
32:613 0:015 returning previously calculated offset: 32C82A000
32:629 0:015 SleepImageOffset: 32C82A000
32:644 0:015 02 01 0C 00 D0 41 08 0A 00 00 00 00 01 01 06 00 | .....A..........
33:180 0:535 02 1F 03 12 0A 00 00 00 00 00 00 00 04 04 18 00 | ................
33:730 0:550 33 00 32 00 43 00 38 00 32 00 41 00 30 00 30 00 | 3.2.C.8.2.A.0.0.
34:262 0:531 30 00 00 00 7F FF 04 00 | 0.......
34:668 0:405 boot-image before: PcieRoot(0x0)\Pci(0x1F,0x2)\Sata(0x0,0x0,0x0)\32C82A000

If so, congratulations your Hibernate is working.

 

I can report that here everything is working perfectly. Both in UEFI as Legacy

 

See the official post from Clover - Clover Instructions 

If you encounter problems, see the official post on the hibernating mode in ProjectOSX

 

NOTE: Many have had success using the 29 mode, but if it does not work, try using the 21 way, or another.

sudo pmset -a hibernatemode 21

Bonus.

 

A quick explanation about this commands:

 

pmset -a hibernatemode 0 will save sleepimage only to RAM, this will be Sleep only.

 

pmset -a hibernatemode 1 will save sleepimage only to Disk, this will be a kind of "Soft" Hibernation.

 

pmset -a hibernatemode 3 will save sleepimage to RAM AND Disk, this will be Safe Sleep, first the system

will Sleep and later Hibernate.

 

pmset -a hibernatemode 25 will save sleepimage only to Disk and Remove Power from RAM and some

more devices, this will be "Real" Hibernation.

 

What commands the way that OS X will Sleep/Hibernate, is one of the commands above,

there is no "Hibernate" option in OS X like you can see in Windows and you have to choose

always Sleep at the "Apple" logo of your MenuBar...

 

 

To have sure that your sleepimage isn't corrupted, run the command below...

sudo rm -rf /private/var/vm/sleepimage

A new sleepimage will be generated at the next time the system

goes to sleep...

 

All the thanks go to: Dmazar, Slice, Kyndder,  and alutam.com. 

 

Bonus for Mac users:

If you have a real Mac, and wants know how use the hibernation mode, you can read this excellent article made by Rahul Saigal.

 

Note: This guide has not been tested in macOS Sierra yet...


Edited by Allan, 29 July 2016 - 06:04 PM.
Updated - 07/2016


#2
Allan

Allan

    V.I.P. Member

  • Supervisors
  • 10,415 posts
  • Gender:Male
  • Location:Brazil

I'll buy an SSD, is good use the Hibernation mode?

 

Well, we know that SSDs can boot up very fast in comparison with traditional HDD drivers, and maybe we think when we buy an SSD: "Uh, if i use Hibernation mode, all the things will be more fast!!  :w00t: "

 

Yes but if you already read about how the new SSD's technologies works, you'll see that use Hibernation mode can destroy your new toy.

 

But why this happens?

 

The short explanation: "Hibernation copies everything in RAM into the SSD drive that sometimes results in wearing out the SSDs."

 

Questions:

 

#1 - Q: But using SSD + Hibernation mode, will be good to my Battery life, why i need disable it?

 

A: Using an SSD is very different when you use a HDD drive, consider that using a SSD the power consumption is very low than HDD, you don't need worry about it.  ;)

 

#2 - Q: I don't care about this stuff, i want use Hibernation mode anyway!!

 

A: Ok, ok, relax!  ^_^

You can move the sleepimage file to another drive, maybe an old HDD/SSD.

 

How? Terminal is the answer bro!

 

Run pmset -g command and you can check the current configuration for hibernate.

Spoiler

 

The important informations here are: standbydelay and hibernatefile. The first one say us that our Mac/Hack will wait 4200 seconds before entering the "real' hibernate mode (before any information is written to the disk). The hibernate file is the location where RAM content are stored.

For example I decided just to relocate my sleepimage file.

 

Create folder on the second driver:

Allans-MacBook-Pro:~ allan$ mkdir -p /Volumes/YourHDD/System/vm

Change the hibernatefile property

sudo pmset -a hibernatefile /Volumes/YourHDD/System/vm/sleepimage

Check your currents settings

Allans-MacBook-Pro:~ allan$ sudo pmset -g 
Active Profiles: 
Battery Power -1* 
AC Power -1 
Currently in use: 
standbydelay 4200 
standby 0 
halfdim 1 
sms 1 
hibernatefile /Volumes/YourHDD/System/vm/sleepimage 
disksleep 10 
sleep 10 
hibernatemode 29 
ttyskeepawake 1 
displaysleep 15 
acwake 0 
lidwake 1

Now any time your Mac/Hack enters in hibernate mode, the RAM content is written in /Volumes/Media drive (your second internal HDD/SSD).

 

PS: This "other drive" can be an external HD or a USB3 thumb drive.

PS 2: This tip is valid for Mac users that have SSDs.  :)

 

Creditis to: Simply Meahmed_ais and AskDifferent



#3
Allan

Allan

    V.I.P. Member

  • Supervisors
  • 10,415 posts
  • Gender:Male
  • Location:Brazil

How change Hibernate Mode in El Capitan

 

For OS X El Capitan, you'll need modify the com.apple.PowerManagement.plist.

Type this in Finder > Go > Go to folder/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

 

And find the Hibernate Mode in both section and put the value that you want.







Also tagged with one or more of these keywords: sleep, hibernation


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2016 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy