Mi entorno
-
MacBook Pro (Retina, 13-inch, Mid 2014)
yOS: 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
-
La energía está desenchufada. Por lo tanto, en la batería.
-
Interfaz de ahorro de energía:
-
Mi script:
$ cat sleep-detector.sh while true; do echo `date` " -------- not sleep yet" tput bel sleep 2s done
El problema
-
Desenchufe el cable de alimentación
-
Ejecuta el script en el terminal:
sleep-detector.sh
-
Cierra la tapa. Póngalo en la bolsa trasera. Salir de la oficina, conducir e ir a casa.
-
Después de terminar mi cena. Abre la tapa y comprueba la salida del script:
$ 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
-
Me enteré de que la cosa rara ocurrió durante el tiempo
22:17:06
a22:17:35
. Esto es muy loco. -
Entonces comprobé mi
log show
. Tiene algo así como: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
Lo anterior es sólo una parte del registro. Si alguien quiere ver todo, puedo pegarlo en pastebin.
[Editado]
Muchas gracias a @@Ashley por decirme el comando pmset -g log
Esta es la parte interesante de este comando de registro:
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)\]
La salida de ioreg -l | grep IOPlatformFeatureDefaults
:
$ ioreg -l | grep IOPlatformFeatureDefaults
| | | "IOPlatformFeatureDefaults" = {"DNDWhileDisplaySleeps"=Yes,"TCPKeepAliveDuringSleep"=No,"NotificationWake"=No}
He hecho todo lo posible para evitar que el sistema se despierte solo. He desactivado wake for wiki access
y he desactivado power nap
por completo. ¡Esto es una locura! El sistema nunca debería estar despierto cuando la tapa permanece cerrada y estoy en viaje. Esto es simplemente muy peligroso e inseguro para mí. He luchado contra el estúpido MacOS durante dos días y no sé cómo hacer que permanezca dormido cuando debería y cuando la tapa está cerrada.
PS:
Para los que estén interesados, los siguientes enlaces son los que he encontrado buscando en Google hasta ahora, pero nadie confirma que haya una solución en High Sierra todavía:
enlace1 , enlace2 , enlace3 , enlace4 , enlace5 , enlace6 , enlace7
1 votos
pmset
puede mostrar un registro diferente (o quizás un subconjunto delog show
salida, no estoy seguro) que puede ser útil. Prueba conpmset -g log | grep -i "wake from"
.0 votos
@Ashley Muchas gracias por el mando. No conocía esto antes. Encontré la línea
2018-11-28 22:17:07 +0800 DarkWake DarkWake from Deep Idle [CDN] due to EC.SleepTimer/SleepTimer: Using BATT (Charge:100%) 0 secs
¿qué significa? ¿Por qué está despierto? (Por cierto, también noto que este tiempo de registro es22:17:07
que no es el primer mensaje de registro cuando se despierta en comparación conlog show
el primer mensaje de registro está en22:17:06.766319
. Tal vez pueda ignorar la diferencia horaria).0 votos
@Ashley por cierto, al comprobar el
pmset -g log | vim -
de nuevo. Encontré tres mensajes de registro antes de esta línea: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]
0 votos
@Ashley He editado y puesto la sección interesante del
pmset -g log
al cuerpo de la pregunta. así se puede echar un vistazo desde el cuerpo de la pregunta en lugar de los comentarios con un mejor formato. Muchas gracias.