みーのぺーじ

みーが趣味でやっているPCやソフトウェアについて.Python, Javascript, Processing, Unityなど.

YosemiteにしたらiMacがスリープから復帰しない

先日iMac 2011 を Yosemiteにアップデートしました.しばらく使っていて,スリープすると,復帰に失敗することがあることに気づきました.みーが調べた対処法をまとめておきます.

みーの環境 {#みーの環境 style="color:rgb(55, 55, 55); font-style:normal; text-align:start"}

  • OS X Yosemite 10.10.1
  • iMac (21.5-inch Mid 2011)
  • Processor 2.5 GHz Intel Core i5
  • Memory 12 GB 1333 MHz DDR3
  • Graphics AMD Radeon HD 6750M 512 MB

Yosemiteはリカバリーパーティションからクリーンインストールして使用中.

とりあえずセーフモードで起動 {#とりあえずセーフモードで起動 style="color:rgb(55, 55, 55); font-style:normal; text-align:start"}

Appleのサポートページに,セーフモードで起動する方法が書いてあるので,これにしたがってセーフモードで起動してみました.起動時に音がなったらShiftを押し続けるだけです.しかし,そもそもセーフモード中にスリープしても問題が起きなかったので,OSの中枢でない何かが悪さをしているのかな,ということしかわかりませんでした.

仕方がないので,SMCリセットをしてみる {#仕方がないのでsmcリセットをしてみる style="color:rgb(55, 55, 55); font-style:normal; text-align:start"}

AppleのサポートページにSMCリセットの方法が書いてあるので,これに従ってリセットを行いましたが,やはり問題は解決しませんでした.

クリーンインストールもしたし,起動ディスクの修復はセーフモード起動時に自動実行されるので改めて実行しても意味がないので,もう少し頭を使わないといけないようです.

ログをにらめっこする {#ログをにらめっこする style="color:rgb(55, 55, 55); font-style:normal; text-align:start"}

以下がスリープからの復帰に失敗した時のkernelログです.Utilities/Console.appからコピペ.このログは読み飛ばして次へどうぞ.

12/2/26 H 22:01:06.000 kernel[0]: PM response took 3152 ms (26, powerd)
12/2/26 H 22:01:06.000 kernel[0]: Failed to get hibernate image filename
12/2/26 H 22:01:07.000 kernel[0]: AppleBCM5701Ethernet [en0]: Link down (womp disabled, proxy idle)
--- sleep---
12/2/26 H 22:46:17.000 kernel[0]: Wake reason: EHC2
12/2/26 H 22:46:17.000 kernel[0]: Previous sleep cause: 5
12/2/26 H 22:46:17.000 kernel[0]: The USB device HubDevice (Port 1 of Hub at 0xfa000000) may have caused a wake by issuing a remote wakeup (2)
12/2/26 H 22:46:17.000 kernel[0]: 44327.689168: setDISASSOC from ATH_INTERFACE_CLASS disconnectVap
12/2/26 H 22:46:17.000 kernel[0]: 44327.689180: switchVap from 1 to 1 
12/2/26 H 22:46:17.000 kernel[0]: The USB device Keyboard Hub (Port 2 of Hub at 0xfa100000) may have caused a wake by issuing a remote wakeup (3)
12/2/26 H 22:46:17.000 kernel[0]: TBT W (1): 5 [x]
12/2/26 H 22:46:17.000 kernel[0]: The USB device Apple Keyboard (Port 2 of Hub at 0xfa120000) may have caused a wake by issuing a remote wakeup (3)
12/2/26 H 22:46:17.000 kernel[0]: full wake promotion (reason 1) 149 ms
12/2/26 H 22:46:17.000 kernel[0]: IOThunderboltSwitch<0xffffff802825b400>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 2 unplug = 0
12/2/26 H 22:46:17.000 kernel[0]: IOThunderboltSwitch<0xffffff802825b400>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 1 unplug = 0
12/2/26 H 22:46:17.000 kernel[0]: IOThunderboltSwitch<0xffffff80282bd200>(0x1)::listenerCallback - Thunderbolt HPD packet for route = 0x1 port = 4 unplug = 0
12/2/26 H 22:46:17.000 kernel[0]: AppleThunderboltDPPathManager<0xffffff80283cff00>::createPath - path type 0x1: Initial Credits [int=0 src=0 dst=0] NFC Credits [int=14 src=5 dst=14]
12/2/26 H 22:46:17.000 kernel[0]: AppleThunderboltDPPathManager<0xffffff80283cff00>::createPath - path type 0x2: Initial Credits [int=2 src=2 dst=1] NFC Credits [int=0 src=0 dst=0]
12/2/26 H 22:46:17.000 kernel[0]: AppleThunderboltDPPathManager<0xffffff80283cff00>::createPath - path type 0x4: Initial Credits [int=2 src=7 dst=1] NFC Credits [int=0 src=0 dst=0]
12/2/26 H 22:46:18.000 kernel[0]: AppleThunderboltGenericHAL::earlyWake - complete - took 1016 milliseconds
12/2/26 H 22:46:18.000 kernel[0]: [ PCI configuration begin ]
12/2/26 H 22:46:18.000 kernel[0]: [ PCI configuration end, bridges 16, devices 18 ]
12/2/26 H 22:46:22.000 kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en0, 1-Gigabit, Full-duplex, Symmetric flow-control, EEE enabled, Debug [796d,2301,0de1,0300,c5e1,3800]
12/2/26 H 22:47:35.000 kernel[0]: Longterm timer threshold: 1000 ms
12/2/26 H 22:47:35.000 kernel[0]: PMAP: PCID enabled
12/2/26 H 22:47:35.000 kernel[0]: Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64
12/2/26 H 22:47:35.000 kernel[0]: vm_page_bootstrap: 3016066 free pages and 113278 wired pages
12/2/26 H 22:47:35.000 kernel[0]: kext submap [0xffffff7f80a00000 - 0xffffff8000000000], kernel text [0xffffff8000200000 - 0xffffff8000a00000]
12/2/26 H 22:47:35.000 kernel[0]: zone leak detection enabled
12/2/26 H 22:47:35.000 kernel[0]: "vm_compressor_mode" is 4
12/2/26 H 22:47:35.000 kernel[0]: multiq scheduler config: deep-drain 0, urgent first 1, depth limit 4, band limit 127, sanity check 0
12/2/26 H 22:47:35.000 kernel[0]: standard timeslicing quantum is 10000 us
12/2/26 H 22:47:35.000 kernel[0]: standard background quantum is 2500 us
12/2/26 H 22:47:35.000 kernel[0]: mig_table_max_displ = 13
12/2/26 H 22:47:35.000 kernel[0]: TSC Deadline Timer supported and enabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=1 LocalApicId=0 Enabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=2 LocalApicId=2 Enabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=3 LocalApicId=4 Enabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=4 LocalApicId=6 Enabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=5 LocalApicId=255 Disabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=6 LocalApicId=255 Disabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=7 LocalApicId=255 Disabled
12/2/26 H 22:47:35.000 kernel[0]: AppleACPICPU: ProcessorId=8 LocalApicId=255 Disabled
12/2/26 H 22:47:35.000 kernel[0]: calling mpo_policy_init for TMSafetyNet
12/2/26 H 22:47:35.000 kernel[0]: Security policy loaded: Safety net for Time Machine (TMSafetyNet)
12/2/26 H 22:47:35.000 kernel[0]: calling mpo_policy_init for AMFI
12/2/26 H 22:47:35.000 kernel[0]: Security policy loaded: Apple Mobile File Integrity (AMFI)
12/2/26 H 22:47:35.000 kernel[0]: calling mpo_policy_init for Sandbox
12/2/26 H 22:47:35.000 kernel[0]: Security policy loaded: Seatbelt sandbox policy (Sandbox)
12/2/26 H 22:47:35.000 kernel[0]: calling mpo_policy_init for Quarantine
12/2/26 H 22:47:35.000 kernel[0]: Security policy loaded: Quarantine policy (Quarantine)
12/2/26 H 22:47:35.000 kernel[0]: Copyright (c) 1982, 1986, 1989, 1991, 1993
12/2/26 H 22:47:35.000 kernel[0]: The Regents of the University of California. All rights reserved.
12/2/26 H 22:47:35.000 kernel[0]: MAC Framework successfully initialized
12/2/26 H 22:47:35.000 kernel[0]: using 16384 buffer headers and 10240 cluster IO buffer headers
12/2/26 H 22:47:35.000 kernel[0]: AppleKeyStore starting (BUILT: Sep 19 2014 00:11:30)
12/2/26 H 22:47:35.000 kernel[0]: IOAPIC: Version 0x20 Vectors 64:87
12/2/26 H 22:47:35.000 kernel[0]: ACPI: sleep states S3 S4 S5
12/2/26 H 22:47:35.000 kernel[0]: pci (build 00:11:20 Sep 19 2014), flags 0xe3000, pfm64 (36 cpu) 0xf80000000, 0x80000000
12/2/26 H 22:47:35.000 kernel[0]: AppleIntelCPUPowerManagement: Turbo Ratios 1378
12/2/26 H 22:47:35.000 kernel[0]: AppleIntelCPUPowerManagement: (built 00:11:36 Sep 19 2014) initialization complete
12/2/26 H 22:47:35.000 kernel[0]: [ PCI configuration begin ]
12/2/26 H 22:47:35.000 kernel[0]: Sleep failure code 0x00000002 0x27006700
12/2/26 H 22:47:35.000 kernel[0]: console relocated to 0xf80010000
12/2/26 H 22:47:35.000 kernel[0]: [ PCI configuration end, bridges 16, devices 18 ]
12/2/26 H 22:47:35.000 kernel[0]: Thunderbolt runtime power conservation disabled.
12/2/26 H 22:47:35.000 kernel[0]: mcache: 4 CPU(s), 64 bytes CPU cache line size
12/2/26 H 22:47:35.000 kernel[0]: mbinit: done [96 MB total pool size, (64/32) split]
12/2/26 H 22:47:35.000 kernel[0]: rooting via boot-uuid from /chosen: EF17675E-B87A-3FE9-956F-24C4483EA690
12/2/26 H 22:47:35.000 kernel[0]: Waiting on IOProviderClassIOResourcesIOResourceMatchboot-uuid-media
12/2/26 H 22:47:35.000 kernel[0]: com.apple.AppleFSCompressionTypeZlib kmod start
12/2/26 H 22:47:35.000 kernel[0]: com.apple.AppleFSCompressionTypeDataless kmod start
12/2/26 H 22:47:35.000 kernel[0]: com.apple.AppleFSCompressionTypeZlib load succeeded
12/2/26 H 22:47:35.000 kernel[0]: com.apple.AppleFSCompressionTypeDataless load succeeded
12/2/26 H 22:47:35.000 kernel[0]: AppleIntelCPUPowerManagementClient: ready
12/2/26 H 22:47:35.000 kernel[0]: Got boot device = IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT0@0/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/WDC WD5000AAKS-402AA0 Media/IOGUIDPartitionScheme/Machintosh HD@2
12/2/26 H 22:47:35.000 kernel[0]: BSD root: disk0s2, major 1, minor 2
12/2/26 H 22:47:35.000 kernel[0]: jnl: b(1, 2): replay_journal: from: 4154880 to: 9697280 (joffset 0xe8a000)
12/2/26 H 22:47:35.000 kernel[0]: FireWire (OHCI) Lucent ID 5901 built-in now active, GUID c82a14fffe7ff076; max speed s800.
12/2/26 H 22:47:35.000 kernel[0]: USBMSC Identifier (non-unique): 000000009833 0x5ac 0x8403 0x9833, 2
12/2/26 H 22:47:35.000 kernel[0]: ath_get_caps[4044] rx chainmask mismatch actual 7 sc_chainmak 0
12/2/26 H 22:47:35.000 kernel[0]: 1.911517: ath_get_caps[4019] tx chainmask mismatch actual 7 sc_chainmak 0
12/2/26 H 22:47:35.000 kernel[0]: 1.915326: Atheros: mac 448.3 phy 1558.2 radio 0.0
12/2/26 H 22:47:35.000 kernel[0]: 1.915337: Use hw queue 0 for WME_AC_BE traffic
12/2/26 H 22:47:35.000 kernel[0]: 1.915345: Use hw queue 1 for WME_AC_BK traffic
12/2/26 H 22:47:35.000 kernel[0]: 1.915352: Use hw queue 2 for WME_AC_VI traffic
12/2/26 H 22:47:35.000 kernel[0]: 1.915360: Use hw queue 3 for WME_AC_VO traffic
12/2/26 H 22:47:35.000 kernel[0]: 1.915367: Use hw queue 8 for CAB traffic
12/2/26 H 22:47:35.000 kernel[0]: 1.915373: Use hw queue 9 for beacons
12/2/26 H 22:47:35.000 kernel[0]: 1.915444: wlan_vap_create : enter. devhandle=0x42262718, opmode=IEEE80211_M_STA, flags=0x1
12/2/26 H 22:47:35.000 kernel[0]: 1.915487: wlan_vap_create : exit. devhandle=0x42262718, opmode=IEEE80211_M_STA, flags=0x1.
12/2/26 H 22:47:35.000 kernel[0]: bpfAttach len 88 dlt 127
12/2/26 H 22:47:35.000 kernel[0]: bpfAttach len 124 dlt 192
12/2/26 H 22:47:35.000 kernel[0]: bpfAttach len 24 dlt 105
12/2/26 H 22:47:35.000 kernel[0]: 1.915538: ATH tunables:
12/2/26 H 22:47:35.000 kernel[0]: 1.915542:   pullmode[1] txringsize[  256] txsendqsize[1024] reapmin[   32] reapcount[  128]
12/2/26 H 22:47:35.000 kernel[0]: jnl: b(1, 2): journal replay done.
12/2/26 H 22:47:35.000 kernel[0]: hfs: mounted Macintosh HD on device root_device
12/2/26 H 22:47:35.000 kernel[0]: VM Swap Subsystem is ON
12/2/26 H 22:47:35.000 kernel[0]: hfs: Removed 78 orphaned / unlinked files and 29263 directories 
12/2/26 H 22:47:38.000 kernel[0]: IO80211Controller::dataLinkLayerAttachComplete():  adding AppleEFINVRAM notification
12/2/26 H 22:47:38.000 kernel[0]: IO80211Interface::efiNVRAMPublished():  
12/2/26 H 22:47:38.000 kernel[0]: bpfAttach len 64 dlt 12
12/2/26 H 22:47:40.000 kernel[0]: IOGraphics flags 0x43
12/2/26 H 22:47:40.000 kernel[0]: [IOBluetoothHCIController][start] -- completed
12/2/26 H 22:47:40.000 kernel[0]: IOBluetoothUSBDFU::probe
12/2/26 H 22:47:40.000 kernel[0]: IOBluetoothUSBDFU::probe ProductID - 0x8215 FirmwareVersion - 0x0208
12/2/26 H 22:47:40.000 kernel[0]: **** [IOBluetoothHostControllerUSBTransport][start] -- completed -- result = TRUE -- 0xb800 ****
12/2/26 H 22:47:40.000 kernel[0]: **** [BroadcomBluetoothHostControllerUSBTransport][start] -- Completed -- 0xb800 ****
12/2/26 H 22:47:40.000 kernel[0]: [IOBluetoothHCIController][staticBluetoothTransportShowsUp] -- Received Bluetooth Controller register service notification -- 0xb800 
12/2/26 H 22:47:40.000 kernel[0]: [IOBluetoothHCIController::setConfigState] calling registerService
12/2/26 H 22:47:40.000 kernel[0]: **** [IOBluetoothHCIController][ProcessBluetoothTransportShowsUpActionWL] -- Connected to the transport successfully -- 0x2300 -- 0x4000 -- 0xb800 ****
12/2/26 H 22:47:40.000 kernel[0]: ** GPU Hardware VM is disabled (multispace: disabled, page table updates with DMA: disabled)
12/2/26 H 22:47:41.000 kernel[0]: Previous shutdown cause: 3
12/2/26 H 22:47:41.000 kernel[0]: DSMOS has arrived
12/2/26 H 22:47:42.000 kernel[0]: bpfAttach len 124 dlt 192
12/2/26 H 22:47:42.000 kernel[0]: bpfAttach len 88 dlt 127
12/2/26 H 22:47:42.000 kernel[0]: bpfAttach len 24 dlt 105
12/2/26 H 22:47:42.000 kernel[0]: AirPort: Link Down on en1. Reason 8 (Disassociated because station leaving).
12/2/26 H 22:47:42.000 kernel[0]: en1::IO80211Interface::postMessage bssid changed
12/2/26 H 22:47:46.000 kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en0, 1-Gigabit, Full-duplex, Symmetric flow-control, EEE enabled, Debug [796d,0301,0de1,0300,c5e1,3800]
12/2/26 H 22:47:48.000 kernel[0]: AtherosNewma40P2PInterface::init name  role 1
12/2/26 H 22:47:48.000 kernel[0]: AtherosNewma40P2PInterface::init  role 1
12/2/26 H 22:47:49.000 kernel[0]: 31.201248: setDISASSOC from ATH_INTERFACE_CLASS disconnectVap
12/2/26 H 22:47:49.000 kernel[0]: 31.201273: switchVap from 1 to 1 
12/2/26 H 22:47:49.000 kernel[0]: en2: promiscuous mode enable succeeded
12/2/26 H 22:47:51.000 kernel[0]: hfs: early journal init: volume on disk3 is read-only and journal is dirty.  Can not mount volume.
12/2/26 H 22:47:51.000 kernel[0]: hfs_mountfs: hfs_early_journal_init failed, erroring out 
12/2/26 H 22:47:51.000 kernel[0]: hfs_mount: hfs_mountfs returned error=22 for device disk3
12/2/26 H 22:47:51.000 kernel[0]: hfs: early journal init: volume on disk4 is read-only and journal is dirty.  Can not mount volume.
12/2/26 H 22:47:51.000 kernel[0]: hfs_mountfs: hfs_early_journal_init failed, erroring out 
12/2/26 H 22:47:51.000 kernel[0]: hfs_mount: hfs_mountfs returned error=22 for device disk4
12/2/26 H 22:47:51.000 kernel[0]: jnl: disk3: replay_journal: from: 75367424 to: 82633728 (joffset 0x1d1d000)
12/2/26 H 22:47:51.000 kernel[0]: jnl: disk4: replay_journal: from: 255393792 to: 257073152 (joffset 0x48c8000)
12/2/26 H 22:47:52.000 kernel[0]: jnl: disk4: journal replay done.

ざっと見た感じ以下の部分がヒントになりそうかな.

Failed to get hibernate image filename
The USB device Keyboard Hub (Port 2 of Hub at 0xfa100000) may have caused a wake by issuing a remote wakeup (3)
Sleep failure code 0x00000002 0x27006700

おそらく,メモリーの内容を一時的にHDDに書きだしたファイル(hibernate image file)に何らかの問題が発生しているのが原因かと思い,ターミナルを開いてpmset -gで確認したところ,(詳細はこちら)

xxxx-iMac:vm xxxx$ pmset -g
Active Profiles:
AC Power        -1*
Currently in use:
 hibernatemode        0
 halfdim              1
 womp                 0
 networkoversleep     0
 sleep                0
 Sleep On Power Button 1
 ttyskeepawake        1
 hibernatefile        /var/vm/sleepimage
 autorestart          0
 disksleep            0
 displaysleep         10

となっていて,hibernatemodeは0で,hibernatefileは/var/vm/sleepimageだったので,hibernatemodeを3に,hibernatefileを削除して再起動した.ちなみに/var/vm/sleepimageは/private/var/vm/sleepimageのエイリアスである.

その後スリープから復帰するかを何度か試してみたが,うまく復帰するようになった.現在のところこれで問題がない.

どうしても直らない場合 {#どうしても直らない場合 style="color:rgb(55, 55, 55); font-style:normal; text-align:start"}

以上のことをやっても復帰に失敗するようならば,スリープ機能を使用しないように設定してOSのアップデートで解決されるのを待つ,というのが最善かもしれない.スリープまでの時間をしないにして,スリープボタンを押さないようにするわけである.

後日談 {#後日談 style="text-align: start;"}

Yosemite 10.10.5をクリーンインストールしたら治りました.よかった.(2015.9.24)