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

14 thoughts on “OS X Mavericks: Wake for network access with NO random wake ups

  1. I’m curious, from the clip in your log it looks like there’s no username associated. Is that the case? No username and password? I’m seeing something in Console that looks like multiple IP addresses attempting to connect over screensharingd

    Dec 19 13:53:20 cpe-##-##-##-###.san.res.rr.com screensharingd[####]: Authentication: FAILED :: User Name: N/A :: Viewer Address: 72.2.113.47 :: Type: VNC DES

    • Correct, there’s no username. I have Remote Management enabled in “Sharing”, and under “Computer Settings” I have setup a password under “VNC viewers may control screen with password” (no username). I also have “Allow access for” (only these users) set to a local administrator, even though this setting doesn’t affect the password via vnc. Hope this helps.

  2. Thanks very much for this blog. I have always failed to understand why a Mac would have to wake up randomly (on average every 2 hours?) to keep WOL alive, while Window computers do WOL without that. Your blog made me understand it is not for WOL but for Bonjour.

  3. For Linux, give this a shot:
    etherwake -D aa:bb:cc:dd:11:23

    The Nirsoft WakeMeOnLan program sounds like a much more simple approach if you don’t already collect mac addresses seen on the network. Thanks for that!

  4. Hi there,

    I followed the instructions in here (twice now) and all I’m getting is my machine completely disconnected form the network and the internet, after i replaced the file with the original plist without the added string I had to restart and then repair permissions in order to gain access to the network and internet again.

    I edited the file on Textedit, using plain text mode and added the extra line exactly where it’s supposed to (at least to my understanding), yet all I’m getting is total disconnection.

    My mac wakes up because of a gige (network) process and then stays on regardless of my energy saving settings.

    Any ideas on what could be going wrong?

    Thanks!

    • Hi,

      unfortunately I can’t help you here 😦
      I myself just edited the file (with ‘sudo pico filename’ if I remember correctly) and it “just worked”. Could be that Textedit is messing with the line breaks or encoding, not sure…

  5. I have discovered that when you do the mod to com.apple.mDNSResponder.plist it somehow breaks the functionality of Bonjour [at least in respect to MulticastAdvertisements].
    In my case it did fix the random wake from sleep issue, but…
    For me it made it so my iBank 5 app on OS X 10.9.2 would no longer connect or “see” the iBank app on my iPad iOS 7.1 and thus I could no longer Sync the data. Also, it broke the wifi printing capability provided by an app named HandyPrint (OS X) which enables me to print from my iPad via wifi to my iMac to an HP 2600n color laserjet (Ethernet). Both of these apps are Bonjour dependent.

    Obviously, I do NOT want my iMac to keep unexpectedly waking from sleep every 2 hours when Wake For Network Access (Energy Saver) is enabled (so the iMac can be awakened via VNC Internet connection outside the LAN).

    Surely, there must be some way to have the best of both worlds here…
    Maybe a Script or Utility or something that can toggle the MulticastAdvertisements ON when waking from sleep and then toggle them OFF before the iMac goes to sleep???
    I have no idea how to accomplish this though…
    Does anything come to mind?

    Thanks for creating this web page and the info and instructions about this issue. It was a relief to find out I was not the only one experiencing this and that there was a solution. My needs are for the solution to go just a little bit further as apparently I still require some of Bonjour’s services.

    PS: I am NOT a programmer – not by any stretch, I am just seeking a solution for this annoying random wake up issue while still being able to wake the iMac via a VNC connection [and not losing the functionality of Bonjour that some of my apps/devices require]

    • Thanks for the information regarding WiFi printing problems and the iBank app. We’re not using either one in our computer classroom so we’ve not been experiencing any problems.
      I haven’t scripted that much on Mac myself, but surely it’s doable. This post can probably point some programmer/scripter in the right direction though, so thanks for the reply 🙂

  6. Many thanks for your blog article. My problem is the reverse of yours. No matter what I do, I can’t get my Mac Mini to wake reliably. I have tried the WakeOnLAN tool and others. I have also sent the magic packet from my router. But, the Mini will only wake if it has recently gone into sleep mode. If I wait for some time, it just will not respond to the magic packet. There are a lot of complaints on the Apple discussion forums about this.

    I suspect this is because I’m using a Netcomm wireless modem-router instead of an Apple device. The Apple knowledge bank has no advice on how to use the WOL without an Apple router. They seem to assume everyone is using a Bonjour compatible router. What make of modem-router are you using ? Or, are you using an ethernet network ?

  7. I don’t seem to have the mdnsresponser plist file. I’ve looked everywhere and when ivtryvtobopen it in terminal I just get a new buffer. I’m using depicus to wake and that works fine. I just also do not want this intermittent waking shenanigans.

    • Yes, this seems to be true in Yosemite at least. mDNSResponder is replaced by /System/Library/LaunchDaemons/com.apple.discoveryd.plist. I have NOT tried to edit this file myself on Yosemite so can’t tell if it works the same way. I’d be glad to know if it works though.
      I’ll update my blogpost also.

  8. Pingback: Как засыпать и будить Mac по сети :: дополнение – Ish West Script WAU!(lt)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s