Little Gem Software

Mac won't stay in Sleep mode

# The Issue Lately my iMac (model Mid 2012) has trouble staying in sleep mode (believe or not it started on April 1st, yup I am not kidding). When the Mac is in sleep mode every minute or so it briefly wakes from sleep (fans are spinning up) and it goes back into sleep mode.

After some internet searching found several possible causes (and solutions) that might prevent your Mac from either entering sleep mode or staying in sleep mode. Listed below are some of the ones that helped me solving my insomnia-tic Mac.
- [How to find system wake causes in OS X][1] - [Mac OS X: Why your Mac might not sleep or stay in sleep mode][2] - [Mac Won't Sleep - Mac OS X Lion Seems Having Insomnia (Fixed)][3] - [Mac Insomnia? Use pmset To Discover The Reason][4]

# Digging Deeper However none of the described issues matched my scenario, but all the articles combined provided me with valuable tools/commands to start digging further into my issue.

## Processes Blocking Your Mac From Entering Sleep Mode Using the following command (using the Terminal app)

pmset -g assertions

Assertion status system-wide: PreventUserIdleDisplaySleep 0 PreventSystemSleep 0 PreventUserIdleSystemSleep 1 ExternalMedia 0 UserIsActive 0 ApplePushServiceTask 0 BackgroundTask 1 Listed by owning process: pid 2909(backupd): [0x0000000100000ff4] 00:00:00 PreventUserIdleSystemSleep named: "Time Machine backup" pid 2909(backupd): [0x0000000c00000ff3] 00:00:00 BackgroundTask named: "Time Machine backup" The information from this report is the counts for **PreventSystemSleep** and **PreventUserIdleSystemSleep**. If these are not 0 then under **Listed by owning process** you will find a list of processes that are preventing your Mac from entering sleep mode. In the example above a Time Machine backup prevent the Mac from entering sleep mode.

## Reasons For Your Mac To Wake From Sleep mode Using the following command (using the Terminal app) you can get a list of all the times your Mac woke from sleep mode and the reason why it occurred.

syslog |grep -i "Wake reason"

Apr 3 11:18:26 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:18:27 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:23:58 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:24:04 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:30:57 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:31:03 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:54:12 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:54:14 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:56:23 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:56:24 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:57:10 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:57:11 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:57:56 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:57:58 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution Apr 3 11:58:43 Thoth-3 kernel[0] : Wake reason: GIGE (Network) Apr 3 11:58:45 Thoth-3 kernel[0] : Ethernet [AppleBCM5701Ethernet]: Wake reason GIGE - bonjour - conflict resolution

The following is a list of possible Wake reasons: **OHC**: Open Host Controller, USB or Firewire. OHC1 or OHC2 generally a USB keyboard or mouse. **EHC**: Enhanced Host Controller, USB or a wireless devices like bluetooth, they're on the USB bus. **USB**: A USB device woke the machine up. **LID0**: The lid or cover of MacBook, triggered when you open the lid. **RTC**: Real Time Clock Alarm, generally from wake-on-demand services. **PWRB**: The Power Button on your Mac. **GIGE**: Gigabit Ethernet, the internal network card

# Resolving The Issue The first thing that caught my eye is that every Wake event was caused by GIGE, i.e. something happening with the internal network card. So to test this I unplugged the network cable and put my Mac back into sleep mode.... and it stayed in sleep mode. Great!!!

Well not entirely because I am constantly working with large files which I need to be able to copy between several machines, and I don't want to do that over the WiFi connection all the time. Got better things to do that waiting for copy operations to finish.

Looking closer at the results from *syslog* I noticed that it mentioned ***Thoth-3***. I clearly remember naming my iMac ***Thoth*** (I got a thing for ancient Egypt, so I name my machine after [ancient Egyptian gods/goddesses][5]).

Somewhere along the line the name for my Mac has changed from Thoth into Thoth-3 (so I probably missed Thoth-2). As you can see as well Bonjour detects a conflict somewhere.

There are two preference panes (that I know of) where it states the name of your machine, the first on the 'Sharing'-pane and the second in the 'Network'-pane. On the 'Sharing'-pane you will immediately see the entry field aptly named 'Computer Name' ![Sharing preference pane][share] On the 'Network'-pane you will have to first select your Ethernet interface (here named Ethernet) and the click on the 'Advanced...'-button. ![Network preference pane][network] On the next pane select the 'WINS'-tab. Here you will find the [NetBIOS Name][6] for your Mac ![WINS NetBIOS][wins] Most likely both these values will (and should) be the same (although the NetBIOS name will be in all caps). In my case they were, but Thoth-3 (and THOTH-3) instead of just Thoth.

I changed both the Computer Name and the NetBIOS name back to what I had originally named my Mac and to be safe rebooted the machine. After the machine was up and running again checked the values again just to be sure and detected no unwanted changes.

As a final test put the Mac into sleep mode again and waited... and waited some more for good measure. The Mac was no longer waking up from sleep mode every minute. Hooray!!

Not sure how or why but somewhere along the line these (automa[t|g]ic?) name changes were causing Bonjour in a constant loop to resolve conflicts

# Closing Statement From the searches I performed online it was funny (or actually a bit disappointing) that the information on Apple's own support site was the least helpful. Just saying...

***PS: I am by no means an expert on network related stuff so if anything is incorrect in this post, that's why but at least it got the issue resolved.*** [1]: http://comp2juneja.blogspot.nl/2013/03/how-to-find-system-wake-causes-in-os-x.html [2]: http://support.apple.com/kb/HT1776?viewlocale=en_US&locale=en_US [3]: http://www.adeepbite.com/lion-seems-having-insomnia-it-doesnt-sleep-easily/ [4]: http://www.macobserver.com/tmo/article/osx_lion_pmset_shows_app_imposed_sleep/ [5]: http://www.ancientegypt.co.uk/gods/explore/main.html [6]: http://en.wikipedia.org/wiki/NetBIOS [share]: https://dl.dropbox.com/u/265253/scriptogram/sharing-pane.png [network]: https://dl.dropbox.com/u/265253/scriptogram/network-pane.png [wins]: https://dl.dropbox.com/u/265253/scriptogram/network-wins.png


LGS Logo
Little Gem Software
Copyright © 2017 Little Gem Software. All Rights Reserved.