3

My Environment

  • MacBook Pro (Retina, 13-inch, Mid 2014) and OS: 10.13.6.

  • pmset:

    $ pmset -g
    System-wide power settings:
    Currently in use:
     standbydelay         10800
     standby              1
     halfdim              1
     hibernatefile        /var/vm/sleepimage
     powernap             0
     gpuswitch            2
     disksleep            10
     sleep                1
     autopoweroffdelay    28800
     hibernatemode        3
     autopoweroff         1
     ttyskeepawake        1
     displaysleep         2
     acwake               0
     lidwake              0
  • Power unplugged. Thus on Battery.

  • Energy Saver UI:

enter image description here

enter image description here

  • My script:
$ cat sleep-detector.sh 
while true;
do
    echo `date` " -------- not sleep yet"
    tput bel
    sleep 2s
done

The Problem

  • Unplug the power cable

  • Run the script in terminal: sleep-detector.sh

  • Close the lid. Put it to backbag. Leave office, Drive and go home.

  • After finishing my dinner. Open the lid and check the script's output:

$ sleep-detector.sh 
Wed Nov 28 21:20:23 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:25 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:27 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:29 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:31 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:33 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:35 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:37 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:39 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:41 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:43 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:45 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:47 CST 2018  -------- not sleep yet
Wed Nov 28 21:20:49 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:08 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:10 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:10 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:12 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:14 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:16 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:18 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:20 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:22 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:24 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:26 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:28 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:30 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:32 CST 2018  -------- not sleep yet
Wed Nov 28 21:21:34 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:06 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:08 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:10 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:12 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:14 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:16 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:18 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:20 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:22 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:24 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:26 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:29 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:31 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:33 CST 2018  -------- not sleep yet
Wed Nov 28 22:17:35 CST 2018  -------- not sleep yet
Wed Nov 28 23:20:32 CST 2018  -------- not sleep yet
Wed Nov 28 23:20:34 CST 2018  -------- not sleep yet
Wed Nov 28 23:20:36 CST 2018  -------- not sleep yet
  • I found out the weird thing happened during the time 22:17:06 to 22:17:35. This is very crazy.

  • Then I checked my log show. It has something like:

2018-11-28 22:17:06.766319+0800 0x74       Default     0x0                  0      0    kernel: PMRD: System Wake
2018-11-28 22:17:06.766358+0800 0x36749    Default     0x0                  0      0    kernel: IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 1543414626, sm 0xe0000300
2018-11-28 22:17:06.767272+0800 0x74       Default     0x0                  0      0    kernel: (AppleCameraInterface) AppleCamIn::systemWakeCall - messageType = 0xE0000340
2018-11-28 22:17:06.767291+0800 0x36760    Default     0x0                  0      0    kernel: (AppleCameraInterface) AppleCamIn::wakeEventHandlerThread
2018-11-28 22:17:06.767525+0800 0x36749    Default     0x0                  0      0    kernel: (IOBluetoothHostControllerTransport) **** [IOBluetoothHostControllerTransport][powerStateWillChangeTo] -- SleepType is kIOPMSleepTypeDeepIdle -- this = 0x2800 ****
2018-11-28 22:17:06.767775+0800 0x3589b    Default     0x0                  337    0    CommCenter: [com.apple.CommCenter:sysobs] #I On WiFi: true On Cellular: false
2018-11-28 22:17:06.767805+0800 0x36749    Default     0x0                  0      0    kernel: (AppleCredentialManager) AppleCredentialManager: powerStateDidChangeToGated: SYSTEM IS AWAKE.
2018-11-28 22:17:06.767826+0800 0x36742    Default     0x0                  0      0    kernel: (AppleCredentialManager) AppleCredentialManager: handleEventGated: called, eventID = 4.
2018-11-28 22:17:06.768095+0800 0x3674b    Default     0x0                  0      0    kernel: (AppleSmartBatteryManager) SmartBattery: handleSystemSleepWake(0) = 0
2018-11-28 22:17:06.768302+0800 0x36764    Default     0x0                  0      0    kernel: (AppleSMC) Previous sleep cause: 5
2018-11-28 22:17:06.769652+0800 0x253      Activity    0x2aadb              53     0    configd: (CoreFoundation) Loading Preferences From System CFPrefsD For Search List
2018-11-28 22:17:06.769798+0800 0x36707    Activity    0x2aadc              53     0    configd: processing network kernel events
2018-11-28 22:17:06.770942+0800 0x36707    Activity    0x2aadd              53     0    configd: processing network kernel events
2018-11-28 22:17:06.771451+0800 0x36707    Activity    0x2aade              53     0    configd: processing network kernel events
2018-11-28 22:17:06.773454+0800 0x0        Timesync    0x0                  0      0    === system wallclock time adjusted
2018-11-28 22:17:06.774564+0800 0x365a2    Default     0x0                  440    0    icdd: (ICALogging) [com.apple.imagecapture:icdd] #ICDebug - 51:{ICWiredBrowser.m} (USB terminate)
2018-11-28 22:17:06.774585+0800 0x365a2    Default     0x0                  440    0    icdd: (ICALogging) [com.apple.imagecapture:icdd] #ICDebug - 344:{ICWiredBrowser.m} (--> USB Terminate)
2018-11-28 22:17:06.774622+0800 0x1e7      Default     0x0                  54     0    powerd: [powerd:sleepWake] Continue to use current inactivity window from 'Wed Nov 28 22:16:46 2018' to 'Thu Nov 29 10:01:46 2018'
2018-11-28 22:17:06.774732+0800 0x365a2    Default     0x0                  440    0    icdd: (ICALogging) [com.apple.imagecapture:icdd] #ICDebug - 371:{ICWiredBrowser.m} (0 USB Descriptions Managed)
2018-11-28 22:17:06.774741+0800 0x365a2    Default     0x0                  440    0    icdd: (ICALogging) [com.apple.imagecapture:icdd] #ICDebug - 373:{ICWiredBrowser.m} (, kNotificationPower
2018-11-28 22:17:06.778296+0800 0x36713    Default     0x0                  83     0    locationd: [com.apple.locationd.Legacy:Generic] WIFI_LOC: reset
2018-11-28 22:17:06.778365+0800 0x1e7      Default     0x0                  0      0    kernel: (AppleSmartBatteryManager) Starting poll type 2
2018-11-28 22:17:06.778367+0800 0x1e7      Default     0x0                  0      0    kernel: (AppleSmartBatteryManager) Restarting poll type 2
2018-11-28 22:17:06.778529+0800 0x3675c    Default     0x0                  41     0    UserEventAgent: (com.apple.cts) [com.apple.xpc.activity:calendarinterval] Running StartCalendarInterval: com.apple.newsyslog.268435461
2018-11-28 22:17:06.778559+0800 0x1f8      Default     0x0                  77     0    apsd: power management notification 0x8019
2018-11-28 22:17:06.778577+0800 0x36713    Default     0x0                  83     0    locationd: [com.apple.locationd.Core:Core] {"msg":"#Awareness Wifi power state changed", "powered":0}
2018-11-28 22:17:06.778580+0800 0x1f8      Default     0x0                  77     0    apsd: : prepareForWakingIntoDarkWake
2018-11-28 22:17:06.779018+0800 0x253      Default     0x0                  53     0    configd: (IPConfiguration) [com.apple.IPConfiguration:Server] en0 link INACTIVE
2018-11-28 22:17:06.779206+0800 0x253      Default     0x0                  53     0    configd: (IPConfiguration) [com.apple.IPConfiguration:Server] en0: no SSID
2018-11-28 22:17:06.779411+0800 0x3653f    Default     0x0                  82     0    securityd: [com.apple.securityd:powerwatch] powerstates
2018-11-28 22:17:06.779412+0800 0x3653f    Default     0x0                  82     0    securityd: [com.apple.securityd:powerwatch] disk
2018-11-28 22:17:06.779413+0800 0x3653f    Default     0x0                  82     0    securityd: [com.apple.securityd:powerwatch] net
2018-11-28 22:17:06.779414+0800 0x3653f    Default     0x0                  82     0    securityd: [com.apple.securityd:powerwatch] enter DarkWake
2018-11-28 22:17:06.779445+0800 0x3678d    Activity    0x2aa8a              76     0    opendirectoryd: Internal request
2018-11-28 22:17:06.779485+0800 0x205      Default     0x0                  78     0    timed: [com.apple.timed:data] cmd,PmCallback,msg,0x19
2018-11-28 22:17:06.779502+0800 0x3678d    Activity    0x2aa8b              76     0    opendirectoryd: Internal request
2018-11-28 22:17:06.779533+0800 0x3678d    Activity    0x2aa8c              76     0    opendirectoryd: Internal request
2018-11-28 22:17:06.779565+0800 0x205      Activity    0x10427              78     0    timed: (CoreFoundation) Loading Preferences From System CFPrefsD For Search List
2018-11-28 22:17:06.779647+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] -> Powering to On State.
2018-11-28 22:17:06.779653+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager]     Capabilities:
2018-11-28 22:17:06.779657+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] disk
2018-11-28 22:17:06.779660+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] net
2018-11-28 22:17:06.779662+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager]
2018-11-28 22:17:06.779694+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] -> Powering to On State.
2018-11-28 22:17:06.779697+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager]     Capabilities:
2018-11-28 22:17:06.779700+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] disk
2018-11-28 22:17:06.779702+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager] net
2018-11-28 22:17:06.779704+0800 0x206      Default     0x0                  97     7    bluetoothd: (IOBluetooth) [com.apple.bluetooth:CBXPCManager]
2018-11-28 22:17:06.779749+0800 0x205      Activity    0x10428              78     0    timed: (CoreFoundation) Loading Preferences From User CFPrefsD For Search List

The above is just part of the log. If anyone want to see all, I can paste it to pastebin.

[Edited]

Thank @@Ashley very much to tell me the command pmset -g log, this is the interesting part from this log command:

2018-11-28 22:17:06 +0800 Kernel Client Acks    Delays to Sleep notifications: [powerd is slow(17835 ms)] [AppleThunderboltNHIType2 driver is slow(msg: WillChangeState to 2)(364 ms)] [RP03 driver is slow(msg: SetState to 0)(1277 ms)]           
2018-11-28 22:17:06 +0800 Assertions            PID 168(mDNSResponder) Created MaintenanceWake "mDNSResponder:maintenance" 00:00:00  id:0x0xd00008a26 [System: DeclUser kDisp]          
2018-11-28 22:17:07 +0800 Assertions            PID 168(mDNSResponder) Released MaintenanceWake "mDNSResponder:maintenance" 00:00:00  id:0x0xd00008a26 [System: PrevIdle DeclUser kDisp]          
2018-11-28 22:17:07 +0800 DarkWake              DarkWake from Deep Idle [CDN] due to EC.SleepTimer/SleepTimer: Using BATT (Charge:100%) 0 secs    
2018-11-28 22:17:07 +0800 HibernateStats        hibmode=3 standbydelay=10800                                                          16            
2018-11-28 22:17:07 +0800 Sleep                 Entering Sleep state due to 'Clamshell Sleep': Using Batt (Charge:100%) 3805 secs 
2018-11-28 22:17:35 +0800 PM Client Acks        Delays to Sleep notifications: [AirPort configd plug-in is slow(691 ms)] [com.apple.apsd timed out(28010 ms)]           

The output from ioreg -l | grep IOPlatformFeatureDefaults:

$ ioreg -l | grep IOPlatformFeatureDefaults
    | | |   "IOPlatformFeatureDefaults" = {"DNDWhileDisplaySleeps"=Yes,"TCPKeepAliveDuringSleep"=No,"NotificationWake"=No}

I have done everything I can do to prevent the system to wake up by itself. I have disabled wake for wiki access and I have disabled power nap completely. This is just CRAZY!!! The system should never never be awake when the lid remains closed and I am in travel. This is just very dangerous and unsafe to me. I have fight against the stupid MacOS for two days and don't figure out how to make it just remain sleep when it should and when the lid is closed.

PS:

For those who are interesting, the following links are what I found by googling so far, but no one confirm there is a solution in High Sierra yet:

link1, link2, link3, link4, link5, link6, link7

  • 1
    pmset can show a different log (or perhaps a subset of log show output, I'm not sure) which can be helpful. Try pmset -g log | grep -i "wake from". – Ashley Nov 28 '18 at 21:43
  • @Ashley Thank you very much for the command. I never knew this before. I found the line 2018-11-28 22:17:07 +0800 DarkWake DarkWake from Deep Idle [CDN] due to EC.SleepTimer/SleepTimer: Using BATT (Charge:100%) 0 secs so what does it mean? Why is awake? (Btw I also notice that this log time is 22:17:07 which is not the first log message when it wakes up compared to log show, the first log msg is at 22:17:06.766319. Maybe I can just ignore the time difference.) – sgon00 Nov 29 '18 at 1:52
  • @Ashley btw, by checking the pmset -g log | vim - again. I found three log msgs before this line: 22:17:06 Kernel Client Acks Delays to Sleep notifications: [powerd is slow] [AppleThunderboltNHIType2 driver is slow(msg: WillChangeState to 2)] [RP03 driver is slow(msg: SetState to 0)] 22:17:06 Assertions PID 168(mDNSResponder) Created MaintenanceWake "mDNSResponder:maintenance" 00:00:00 [System: DeclUser kDisp] 22:17:07 Assertions PID 168(mDNSResponder) Released MaintenanceWake "mDNSResponder:maintenance" 00:00:00 [System: PrevIdle DeclUser kDisp] – sgon00 Nov 29 '18 at 2:00
  • @Ashley I have edited and put the interesting section from the pmset -g log to the question body. so you can take a look from the question body instead of comments with a better formatting. Thanks a lot. – sgon00 Nov 29 '18 at 2:06
1

Un-check System Pref, Bluetooth Advanced Allow Bluetooth devices to wake this computer !

  • Thanks a lot for the tip. Even if I don't think that is the cause because my bluetooth is off all the time, but I still unchecked this option. I will disable everything which may cause the laptop to wake. Btw I have added the log msg from pmset -g log to the question body. Some interesting part is MaintenanceWake "mDNSResponder:maintenance" and DarkWake from Deep Idle [CDN] due to EC.SleepTimer/SleepTimer. I am googling this right now. – sgon00 Nov 29 '18 at 2:14
  • Did you try to disconnect or turn off wifi in Network settings ? Then create a new Location name delete the Blooththooth Pan and Thunderbolt options, then click on the Gear icon and choose manage virtual interfaces to OFF, then Shut Down? Will it wake even if you do that? – Lisa Ann Nov 30 '18 at 19:03
  • Wait I see you tagged voice dictation. Shut the lid and do not speak not even to yourself. – Lisa Ann Nov 30 '18 at 19:12
  • Do you use Chrome on any of your devices? – Lisa Ann Nov 30 '18 at 19:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .