One common discussion here at the day job can be summed up with a single statement:
“Why do my Macs keep falling off the Active Directory domain?”
I have a Mac Pro here at the day job that is bound to Active Directory. It’s a really large Active Directory with multiple sites and subnets. As a result, there are different domain controllers in those multiple Active Directory sites. Hey, it’s Active Directory, so the more machines the merrier, right?
After a few days of using the Mac Pro, I would often notice that logins from screen savers or from loginWindow would take longer than they should. That was usually a symptom of what every Mac user fears…
…you’ve fallen off the domain again.
There can be multiple reasons for falling off the domain. There’s a lot of data out there about how Macs do not like to renew their machine account passwords. Sometimes it has something to do with kerberos. Sometimes it has something to do with the moon.
In my case, I notice that when it happens to this Mac Pro:
- Logins take forever at the screensaver (already noted)
- Logins at loginWindow take forever (already noted)
- Kerberos tickets are not granted or renewed (error about unable to reach a kdc for the requested realm)
- winbindd keeps throttling and restarting every minute (note this in the console log)
-
1/21/11 11:49:58 AM com.apple.launchd[1] (org.samba.winbindd) Throttling respawn: Will start in 10 seconds
1/21/11 11:50:08 AM com.apple.launchd[1] (org.samba.winbindd[1006]) Exited with exit code: 1
1/21/11 11:49:58 AM com.apple.launchd[1] (org.samba.winbindd) Throttling respawn: Will start in 10 seconds1/21/11 11:50:08 AM com.apple.launchd[1] (org.samba.winbindd[1006]) Exited with exit code: 1
- other random failures that require AD lookups
In the past I had a ritual. The ritual involves a force unbind and rebind of the machine to the directory. This would work for a while but it was only a matter of hours or days before it happened again. Finally I went to an extreme and reformatted the machine in hope that it would shake something loose.
Within 48 hours it happened again.
I often have to use a VPN to connect this Mac to a different network to perform some administration. In the Active Directory world this means I connect to a whole new set of domain controllers that are located in another Active Directory site. These AD sites are usually carved out by subnet and firewalled. Therefore if you connect to another AD site and cannot communicate with your old domain controllers for some reason you might drop off the domain.
I noticed that when I was connected to the VPN, DirectoryService seemed to work okie. The winbindd restarts stopped and the domain would start reporting correctly. I disconnected the VPN and watched the console log. There was a log about the network change notification, which was expected… then DirectoryService appeared to try to communicate with the Active Directory. It seemed to work, but if you look in the Directory application you’d discover that it’s fallen off the domain once again.
Connect up to the VPN – see the network change event… voila, everything works again.
Aha. So the Mac wasn’t detecting the change in Active Directory site properly. Interesting.
I conferred with another fellow here that works on the standard load for Macintosh systems in the environment. He mentioned that I should take a look and see what was written in the file:
/Library/Preferences/DirectoryService/ActiveDirectoryDynamicData.plist
…under the node “AD Domain Node List.”
We took a look and discovered that the domain controllers for the site on the VPN network were listed there. When I disconnected from the VPN, the file was not rewritten to include the domain controllers for the regular network as it should. Therefore, when the Mac tried to communicate with the domain controllers it was looking in this file and trying to connect to the domain controllers on the VPN AD site. That’s the wrong answer.
The theory? Well, it would appear that during some network change events the ActiveDirectoryDynamicData.plist file is regenerated properly with the domain controllers for the new AD site. However something is making it stick. After disconnecting from the VPN or returning to the home network this file is not regenerated properly.
To resolve, I did the following… after returning to the home network or disconnecting from the VPN and experiencing a failure with communication to Active Directory, you need to tell DirectoryService to regenerate the file:
cd /Library/Preferences/DirectoryService
sudo mv ActiveDirectoryDynamicData.plist ActiveDirectoryDynamicData.plist.old
sudo killall DirectoryService
Note that you’ll have to be an administrator of the machine and use your password for the first sudo command. But you knew that, right?
After a few seconds you should see DirectoryService try to talk to the domain and update the machine password in the console log. Not long after that you should see a new ActiveDirectoryDynamicData.plist file. Chances are good this new “AD Domain Node List” will contain domain controllers for the site/subnet in which you’re now located.
If you’re crafty and have this problem often, you might want to script up something that will automatically shove this file aside and restart DirectoryService on a network change event. It appears that DirectoryService does not always rebuild this file on a network change event by itself.
I hope this helps someone out there. Leave a comment if you have other tips for keeping a Mac alive on an Active Directory network.
Blabber back