Due to my new computer purchase and subsequent data transfers, I had an extra Power Mac G4 lying about the floor. Finally, I had a dedicated machine with which to experiment with the copy of Mac OS X Server I have. I had already installed Mac OS X Server on a drive in another machine, but then moved this drive to a new machine, with a new IP address and a new hostname.
I thought that changing the hostname for my server would be easy, no more complicated than changing the Computer Name setting in the Sharing pane of System Preferences.app, but evidently this is not the case. In the Apple world, every computer actually has three names:
- The Apple Computer Name
- The UNIX hostname (often, but not always, as part of the DNS name)
- The Bonjour name.
In Mac OS X client, all three of these names are changed in the Sharing Pane of System Preferences.app. In Mac OS X Server, however, things are not so straight-forward. Since the machine is a server and is sensitive to its network settings such as these, there are a number of places that include both files on the filesystem and directories (such as LDAP or NetInfo databases) that need to be modified in order for the hostname or IP address (if set manually) to change.
This issue manifested itself for me when I tried simply changing the Computer Name in the Sharing pane of System Preferences and noted that, while Server Admin.app and a number of other places had correctly picked up this change, the
hostname command and my
bash shell prompt had not. They still read “Proteus,” the old hostname even after I had changed it to “Minotaur,” the new hostname I wanted to use.
/var/log/system.log file showed that during boot,
configd was explicitly setting the hostname to this old value (Proteus.local), though I could not find out where this value was coming from. After futzing with innumerable files and GUI tools, I finally got the solution I needed: use the Apple-supplied
changeip command line tool to update all the necessary places at once.
In my case, since only the hostname needed to change and not the IP address, and because my Mac OS X Server machine was a standalone server which used only its own local NetInfo database as a directory store, the command I needed was the following:
sudo changeip - 192.168.0.10 192.168.0.10 Proteus.local Minotaur.local
Note that the IP addresses for both the old-ip and the new-ip parameters are the same, thus denoting “no change” in IP address.
Finally, this can be checked with:
sudo changeip -checkhostname
So, a simple thing really, that took me almost two days to solve. This is the wonder of vendor-specific tools. They give you increadible ease-of-use, if you already know about them.
The following is a list of related resources that I discovered while trying to learn more about this issue.
- Apple KBase #303697: Mac OS X Server 10.4.6: Changes in server hostname discovery – This describes a change in behavior from prior versions of Mac OS X Server in regards to how the system auto-configures its various hostnames.
- kbase: Mac OS X Server 10.4.6: Changes in Server Hostname Discovery and changeip – This is an expanded explanation with background information about the above Apple KBase article and a point about the necessity for using the
- Mac OS X Server Command Line Administration for Version 10.3 or Later (PDF) – Specifically, see the section entitled “Moving a Server” on page 27 as well as the section entitled “Changing a Server’s IP Address” on page 37.