Improving Sleep on a Hackintosh (Wakeup, Freezes, Black Screens)

Hackintosher

Administrator
Joined
Jan 21, 2018
macOS
Mobo
Gigabyte Z370N WIFI
CPU
i3-8100
GPU
UHD 630 Graphics
#1
After installing macOS on a hackintosh there are some changes or things you should be aware of when sleep/waking your hackintosh so that you don't have it turning on in the middle of the night or waking to a black screen.

Energy Saver Settings
  1. Open the Settings App
  2. Click Energy Saver
  3. Uncheck
  4. Uncheck Wake for Ethernet Network access
  5. Uncheck Enable Power Nap

It's very important that you uncheck "Enabled Power Nap" and 'Wake for Ethernet network access" so that your computer will wake properly from sleep and wont turn on the middle of the night.

Long Sleep Fix

So on some motherboards if you sleep it longer than normal for like more than 24-48 hours then you may come back to a black screen when you try to wake the machine. To fix or prevent this issue we must disable standby.
  1. Open Terminal
  2. Paste:
    Code:
    sudo pmset -a standby 0
  3. Type in password
Sleep Prevention

Some programs in macOS can prevent your hackintosh from sleeping and it can also depend on what motherboard you are using. For example apps like Chrome is notorious for preventing sleep on a hackintosh paired with an MSI motherboard and also seems to happen when a motherboard is paired with a Nvidia graphics card. If you press sleep on your hackintosh and it immediately wakes up try checking Terminal to see if something is preventing sleep.
  1. Open Terminal
  2. Paste:
    Code:
    sudo pmset -g
  3. Type in password if necessary
Terminal pmset.png

If you look at the sleep row you may see something like "sleep prevented by Google Chrome, UserEventAgent, coreaudiod"

Things like popups in Chrome or video or audio playing can prevent sleep or even auto sleep after a certain time. if you are using that so try closing those applications and seeing if there is any change if this happens to you.

Remember although sleep works on Nvidia and AMD graphic cards sleep with Sky Lake / Kaby Lake / Coffee Lake iGPU only works on the Coffee Lake processors.

USB Ejection

There are certain ports on the back of your motherboard that will cause things like USB flash drives to eject upon wake form sleep. This can be caused by the factory BIOS and I suggest you upgrade the BIOS if you experience this issue. However the real solution is to create a USB SSDT for your hackintosh, which I'm working on a guide for.


If you guys think there anything else you think I should add to this list let me know.
 

Edhawk

Well-known member
Joined
Apr 10, 2018
macOS
10.13.6
Mobo
GA-Z97X-UD5H-BK
CPU
i7-4790K
GPU
Geforce GTX 980TI
#2
Hackintosher, good guide, but maybe it could be extended with some information regarding how Hibernation works in macOS and the various types of 'Hibernation/Sleep' that can be implemented under macOS.

My understanding of Hibernation/Sleep under macOS is as follows:
  • hibernatemode 0 - this will save the sleepimage to RAM
  • hibernatemode 1 - this will save the sleepimage only to Disk
  • hibernatemode 3 - this will save the sleepimage to RAM & Disk, first the system will Sleep and later it will Hibernate.
  • hibernatemode 25 - this will save the sleepimage to Disk Only and remove power from RAM and some other devices, this will be closer to what people think of as Hibernation.
MacOS will Sleep/Hibernate, depending on one of the modes above being set via the necessary terminal command - sudo pmset -a hibernatemode 0

I have read posts on other sites where people use 'hibernatemode=21 or 29' and claim to have sleep/hibernation working on a desktop Hack.

Members also should understand that there is no "Hibernate" option in macOS like you see in Windows.

Regarding your next guide, I agree Hacks missing an SSDT-UIAC.aml &/or just using Rehabman's USBInjectAll.kext are more prone to USB Sleep/wake and boot issues. A guide showing members how to map and identify the USB ports on Z370 motherboards would be very helpful. Especially as most motherboards now have a number of different USB controllers not just Intel.
 

cyberdevs

Active member
Joined
Mar 11, 2018
macOS
10.13.6
Mobo
GA-Z170X-Gaming 5
CPU
Intel Core i7 6700K
GPU
Asus Strix Gaming RX 580 TOP
#3
Few years ago I wrote a guide on how to install macOS Sierra on GA-Z170X-Gaming 5 and a friend of mine SavageAUS wrote this section on how to create the custom SSDT-UIAC as a part of the guide, I hope you guys find it useful.)

How to create custom SSDT-UIAC:
A quick rundown on how to create a custom SSDT-UIAC.
Add the following patch to your config.plist if you don’t already have the patch.

<dict>
<key>Comment</key>
<string>change 15 port limit to 26 in XHCI kext (100-series)</string>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>com.apple.driver.usb.AppleUSBXHCIPCI</string>
<key>Find</key>
<data>g710////EA==</data>
<key>Replace</key>
<data>g710////Gw==</data>
</dict>

or

Name*: AppleUSBXHCIPCI
Find* [HEX] : 83bd74ff ffff10
Replace [HEX] : 83bd74ff ffff1b
Comment: Raise change 15 port limit to 26 in XHCI kext (100-series)
MatchOS: 10.12.x
<dict>
<key>Comment</key>
<string>USB 10.13.4+ by PMHeart</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
g32UDw+DlwQAAA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>Name</key>
<string>com.apple.driver.usb.AppleUSBXHCI</string>
<key>Replace</key>
<data>
g32UD5CQkJCQkA==
</data>
</dict>

or

Name*: com.apple.driver.usb.AppleUSBXHCI
Find* [HEX] : 837D940F 0F839704 0000
Replace [HEX] : 837D940F 90909090 9090
Comment: USB 10.13.4+ by PMHeart
MatchOS: 10.13.x


The USBInjectAll.kext provided in this guide needs to be and stay installed.

Download ioregistryexplorer Version 2.1 from http://macdownload.informer.com/ioregistryexplorer/download/

Download MaciASL from: https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/RehabMan-MaciASL-2017-0117.zip and extract, drag MaciASL.app into /Applications. (Credit RehabMan)

Download OS-X-USB-Inject-All Master from: (Credit RehabMan)
https://github.com/RehabMan/OS-X-USB-Inject-All/archive/master.zip

and extract the zip file.

Inside the OS-X-USB-Inject-All-master folder you will find SSDT-UIAC-ALL.dsl, copy it to your desktop.

Open ioregistryexplorer and find your device id by typing XHC in the search field.

1532632032576.png


Open SSDT-UIAC-ALL.dsl with MaciASL and find your appropriate device id section.

1532632032615.png


Remove all other sections in the SSDT-UIAC-ALL.dsl that do not correspond with your device id leaving just the one section. Skylake does not have a EHCI controller so “HUB1”, ”HUB2”, ”EH01”, "EH02" can be removed and in my case I can also remove "8086_1e31", "8086_8xxx", "8086_9xxx", "8086_9cb1", "8086_9d2f" and "8086_a2af".

Compile the file to make sure there are no errors in the code and then save the file with “ACPI Machine Language Binary”.


Now we turn our attention to ioregistryexplorer, while you have ioregistry open go to the XHC section and take note of the HSxx or SSxx locations that have devices attached. Now plug in a USB 2.0 device into all USB 2.0 you NEED and do the same with USB 3.0 ports with USB 2 and 3 devices and take note of them all.

Returning back to the SSDT-UIAC-ALL.dsl you will see all ports listed, you need to remove the ones you did not take note of and you can also add a comment to the ones you keep.


UsbConnector values = USB 2.0 = 0, USB 3.0 = 3. Internal = 255

USB 2.0 devices plugged into USB 3.0 ports HSxx are still marked as USB 3.0 = 3.

Internal devices such as Bluetooth etc are marked as 255


1532632032651.png


Once you gone through and done this to all the devices you need and removed the ones you don’t you can save your SSDT-UIAC-ALL.dsl in MaciASL. Make sure you rename it to SSDT-UIAC and that the file format is ACPI Machine Language Binary

1532632032685.png


Copy and paste the resulting SSDT-UIAC.aml into your EFI/EFI/CLOVER/ACPI/patched folder.
Disable the port limit patch in config.plist and add SSDT-UIAC.aml into SortedOrder if needed.
Reboot.

Open ioregistryexplorer and test the ports you left enabled USB 2 & 3.

The number of ports you should see in ioreg should be significantly reduced as they are not being injected anymore.
 
Joined
Jul 6, 2018
macOS
10.13.6
Mobo
ASRock Z270 Fatal1ty
CPU
i7700
GPU
Zotac GTX 1060 AMP 6GB
#4
I have a problem with this.
Everytime it happen my hack reboots and I don't know why (config.plist in attachment)

Is it possible to disable sleep and hibernation? I don't want them, my hack must always remain on

I often have apps opened (compiling, etc) and everytime I leave my hack for more than an hour when I come back I have to restart my job from the beginning

Thanks
 

Attachments

cyberdevs

Active member
Joined
Mar 11, 2018
macOS
10.13.6
Mobo
GA-Z170X-Gaming 5
CPU
Intel Core i7 6700K
GPU
Asus Strix Gaming RX 580 TOP
#5
I have a problem with this.
Everytime it happen my hack reboots and I don't know why (config.plist in attachment)

Is it possible to disable sleep and hibernation? I don't want them, my hack must always remain on

I often have apps opened (compiling, etc) and everytime I leave my hack for more than an hour when I come back I have to restart my job from the beginning

Thanks
You can disable sleep from the System preferences under the "Energy Saver"
Uncheck the "Prevent computer from sleeping automatically ......"
or you can use caffeinate command in the terminal with the amount of the time you want to make your system to stay awake like:
caffeinate -t 25000
but it's better to find the root cause of the reboot while system goes to sleep.
 
Joined
Jul 6, 2018
macOS
10.13.6
Mobo
ASRock Z270 Fatal1ty
CPU
i7700
GPU
Zotac GTX 1060 AMP 6GB
#6
Hello and thank you for reply :)
the only option I checked there is put HDD in stop when possible, other options are unchecked
 

Latest posts