OS X Mavericks: Wake for network access with NO random wake ups

I recently installed a Mac classroom with eight 27” iMac’s. They are all joined to Active Directory domain and working just fine. However, when I was trying to come up with a decent solution for managing/connecting to them remotely I ran into some problems. It turned out that the “Wake for network access” feature in Energy saver wake up the computers at random, not only by a magic packet or remote login. This is a bad thing, as I DO NOT want the computers waking up every second hour or so for no specific reason. This will not be good for the hardware either.

This behavior has apparently changed from OS X Snow Leopard, where you had the option to just enable or disable Wake on LAN. No such option exist in Mavericks, and I only want to wake up the computers with a magic packet sent from LAN (and by me). If you investigate the system log it won’t give you that much information about the random wake-ups:

Nov 26 00:22:55 xxxxx kernel[0]: Wake reason: RTC (Alarm)
Nov 26 00:22:55 xxxxx kernel[0]: RTC: Maintenance 2013/11/25 22:22:55, sleep 2013/11/25 22:29:36

Obviously, no one was present at the computer at that time. I googled like crazy and all the solutions I found suggested that I should turn off Wake for network access altogether (Fig 1) to get rid of this random wake up-problem.

energy_saver

Fig 1. Energy Saver

This is probably fine for a home network, but not on a corporate network. How would you connect to a Mac if it’s sleeping and there is no way of waking it? Here’s an explanation of the term RTC:

RTC: Real Time Clock Alarm, is generally from wake-on-demand services like when you schedule sleep and wake on a Mac via the Energy Saver control panel. It can also be from launchd setting, user applications, backups, and other scheduled events.

Source: http://apple.stackexchange.com/questions/79830/why-does-my-imac-wake-itself-up

From this same source (and many others) I could also find out that “it’s documented on Apple’s site that Wake for network access will cause random wake-ups by just running the hard-drives but not starting up the screen; and it will go immediately back to sleep.”

This is just plain stupid. And no, I’ve NOT set up a scheduled sleep and wakeup. I’ve set up nothing, but the Mac still suffers from insomnia. I googled even more and came across an article about Wake on Demand and Bonjour Sleep Proxy. Don’t ask me how I found it because I had been googling all day 🙂 Anyway, here’s a part from the article:

“With Wake on Demand enabled and your Mac in sleep mode, your Mac will occasionally wake for a brief time, without lighting the screen, in order to maintain active shared service registrations with the Bonjour Sleep Proxy. On some Macs, sounds from the optical drive, hard drive, or fans may be heard during these brief periods. Note: Removing a sleeping Mac from the network will automatically remove its registered shared services from the Bonjour Sleep Proxy.”

Source: http://support.apple.com/kb/ht3774

This got me thinking about Bonjour and network discovery, as I’ve noticed other auto discovered workstations in Finder/Shared in OS X. I googled even more about the bonjour service in OS X and found a  nice article about disabling mDNSResponder. This sounded like the “proper” way of disabling the Bonjour service .

I did the steps in the article, which is adding

<string>-NoMulticastAdvertisements</string> to /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist.

Source: http://support.apple.com/kb/HT3789

With this done, I put the test-Mac to sleep and waited over night. Like magic, the Mac was asleep the WHOLE night (which I knew by looking at the system log). NO random RTC wake-ups. Happy days, the mDNSResponder-trick worked! 🙂 I have no need for the Mac’s to discover each other over Bonjour either so no harm done.

UPDATE! OS X Yosemite doesn’t have a mDNSResponder file. (mDNSResponder was replaced by DiscoveryUtil in Yosemite). The new file is located in /System/Library/LaunchDaemons/com.apple.discoveryd.plist. I have NOT tried this same trick with DiscoveryUtil so I don’t know how it will work out. I’m curious though, so please post your solutions if you have successfully disabled the DiscoveryUtil/mDNSResponder in Yosemite (if it’s even needed anymore…).

Now that the computers got their well deserved sleep, I needed a method for waking them up manually 🙂 That said, I downloaded WakeMeOnLan (http://www.nirsoft.net/utils/ wake_on_lan.html) and gave it a go (Fig 2). Feel free to use any similar programs. PingInfoView (Fig 3) from the same developer/company can be used to ping multiple hosts to check wake/sleep status. Again, feel free to use whatever you prefer.

wakemeonlan

Fig 2. WakeMeOnLan

pinginfoview

Fig 3. PingInfoView

After a test run, the Mac(s) woke up from the dead (notice the green dots in Fig 3). Happy days again and problem solved. Finally! This is the system log after a sent Wake on Lan request with WakeMeOnLan:

Nov 27 14:50:42 xxxxx kernel[0]: Wake reason: GIGE (Network)
Nov 27 14:51:01 xxxxx screensharingd[560]: Authentication: SUCCEEDED :: User Name: N/A :: Viewer Address: x.x.x.x :: Type: VNC DES

First the Mac wakes up via WoL, and then I’m able to connect with VNC. This is how it should be, an intentional wake up. Now enjoy your sleeping Mac without insomnia! 🙂

Advertisements