My iMac wakes up from sleep every 70 minutes!

Sebski

macrumors member
Original poster
Oct 8, 2016
35
11
UK
Hello everyone,

I'm here to report strange problem. Problem which started in previous versions OS X but became more and more annoying recently and I decided to investigate further. My iMac is late 2012 model, 21.5 inch, with Fusion Drive and 16GB RAM.

It happened in the past, I mean in previous versions of OS X like Yosemite and El Capitan, but recently I started investigating what is happening and I'm trying to find answer 'why'.

My iMac used to wake itself up randomly. But actually now I now it wasn't and it isn't 'randomly' - my iMac wakes up from sleep exactly every 70 minutes.

I found something like this in Apple Support pages here https://support.apple.com/en-gb/HT202124

(...)Mac notebook and desktop computers have a power standby feature that conserves energy. During standby, the state of your session is saved to flash storage (SSD). Then, the power turns off to some hardware systems such as RAM and USB buses(...)

Other requirements to enter standby are different for notebooks and desktops.
  • Notebooks need to be running on battery power. It also must not have any external connections (such as Ethernet, USB, Thunderbolt, SD card, displays, Bluetooth, and so on).
  • Desktops must have no external media mounted (such as SD cards, USB, or Thunderbolt storage devices).
(...)When the computer exits standby, the state of the system stored on the flash storage is used to restore the system to its pre-standby state. The computer returns to full operation within a few seconds.(...)

The interesting part is: "Desktops must have no external media mounted". And that is actually true - the issue I'm writing about doesn't occur then I have an external drive mounted. And that's explaining why I thought it was a random issue earlier and now I know it's not. Basically, in the past I used to leave all USB drives mounted almost all the time and disconnected them very rarely. But in last few weeks/months I had no drives connected to my iMac and started to notice this waking-up issue every day and investigated until I found the following.

I run pmset command in Terminal (pmset can manipulate power management settings):


I found standbydelay value 4200 seconds which is exactly 70 minutes. And standby value is 1. From manual pages:

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.

So I thought my iMac should enter standby mode after 70 minutes, right? Not really because is the same manual I found next sentence:

standby only works if hibernation is turned on to hibernatemode 3 or 25.

If my understanding is correct, my iMac should never ever enter standby because hibernatemode value is 0, right?

I spent few days testing different scenarios, trying to eliminate other factors which could wake up my iMac. I didn't want to change the value of standbydelay (nor to enable hibernation) because I wanted to fully test it and post my results and questions here without manipulating the settings. I don't have Wake for network access option enabled and I don't allow bluetooth devices to wake my iMac. And also my final test was with everything disconnected: I unmounted all USB drives, I physically disconnected USB cables, I disconnected second screen, I unplugged Ethernet cable and disconnected from Wi-Fi - and my iMac kept waking itself up from sleep every 70 minutes. Here are some logs from one night:

My iMac went sleep at 00:33hrs



and was awake 70 minutes later



then automatically went to sleep after 2 hours



and woke up again after 70 minutes



I not that the easiest answer would be: "Hey, increase standbydelay value and you have no problem!" Thank you but I don't want to do that. I already found some people changing this setting but mostly MacBook users who want to wait longer before their macs hibernate (on machines where this feature actually does what is should do). I'd really like to find out why my iMac doesn't stay in a sleep mode. If need be, I can increase standbydelay value but only as my last resort.

I hope someone will tell me why the heck my iMac keeps waking from sleep :(

Cheers

Edit: I forgot to mention, I already tried resetting System Management Controller (SMC) and also NVRAM.
 
Last edited:

Analog Kid

macrumors 601
Mar 4, 2003
4,778
2,798
Seems the relevant line is "Kernel Idle sleep preventers: IODisplayWrangler"

I'm not sure what that task does, but it sounds like it might have something to do with the second screen. You mentioned disconnecting it-- does it have custom drivers or something?
 

maflynn

Moderator
Staff member
May 3, 2009
63,863
30,388
Boston
Shutdown the computer. Problem solved.
Some of us don't want to shut their computers down and that still doesn't address why the iMac does not function as it

I hope someone will tell me why the heck my iMac keeps waking from sleep :(
OP, here's what I have and as you can see standbydelay is not 4200, I'd recommend you do change that. Clearly the 4200 is having an effect and I have a fairly clean install. I did a clean install of OS X a month or so back and have not upgraded to Sierra. While you may not want to change that value, I believe its that cause and the solution is at hand
Capto_Capture 2016-10-09_06-21-51_AM.png
 

Sebski

macrumors member
Original poster
Oct 8, 2016
35
11
UK
Seems the relevant line is "Kernel Idle sleep preventers: IODisplayWrangler"

I'm not sure what that task does, but it sounds like it might have something to do with the second screen. You mentioned disconnecting it-- does it have custom drivers or something?
The second screen is Apple Cinema DVI Display HD 23 inch. I've had it since September 2015 and I believe this issue started happening before. Apart from standard Apple default drivers I don't have any other software installed for this screen.
[doublepost=1476012251][/doublepost]
OP, here's what I have and as you can see standbydelay is not 4200, I'd recommend you do change that. Clearly the 4200 is having an effect and I have a fairly clean install. I did a clean install of OS X a month or so back and have not upgraded to Sierra. While you may not want to change that value, I believe its that cause and the solution is at hand
View attachment 664157
Please note that you have standby value set to 0 therefore standbydelay doesn't apply, does it? So in theory your system should behave exactly the same as mine and enter hibernation=0 mode when you put it to sleep, right? And from manual pages:

hibernatemode = 0 (binary 0000) by default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.
 

maflynn

Moderator
Staff member
May 3, 2009
63,863
30,388
Boston
Please note that you have standby value set to 0 therefore standbydelay doesn't apply, does it? So in theory your system should behave exactly the same as mine and enter hibernation=0 mode when you put it to sleep, right? And from manual pages:
I haven't messed with any of the settings, and I have no problems with the computer waking up. My point is that you may need to adjust some of the settings to get the results that you want. I think there's no other explanation other then the pmset values are set in such a way that its giving you this issue
 

Sebski

macrumors member
Original poster
Oct 8, 2016
35
11
UK
I haven't messed with any of the settings, and I have no problems with the computer waking up. My point is that you may need to adjust some of the settings to get the results that you want. I think there's no other explanation other then the pmset values are set in such a way that its giving you this issue
I changed standby value to 0 and that seems to fixed my problem. Although I still don't know why it was happening. But I'm not gonna spend more time trying to figure it out. I can now focus on issues "introduced" in the latest versions of macOS and iOS...
 

Sebski

macrumors member
Original poster
Oct 8, 2016
35
11
UK
You immediately went into the OS and changed settings there. Did you check the energysaver preferences if all the checkboxes where turned off?
Yes. I spent nearly a week testing all possible scenarios.
 

Nismo73

macrumors 6502a
Jan 4, 2013
855
426
I have a late 2012 27", and I've noticed over the different OS versions, updates, it will sometimes wake up itself, or with Sierra I've heard the fan running with a black screen in the middle of the night, but with some OS versions in the past it has not happened.
I still have to check all settings, but have for now just been shutting it down for now.
 

Sebski

macrumors member
Original poster
Oct 8, 2016
35
11
UK
Crap! Now I found that my iMac wakes up automatically after every 4 hours (if there's no external drive connected), which is exactly what is set in autopoweroffdelay. Ok, I'm turning off autopoweroff "feature".