Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal prompt machine name changed to "new-host"

The terminal prompt reads
new-host:~ nero$
It normally starts with
nerombp17

This happened once before when my computer's name mysteriously changed to xxx (2) but after renaming the computer back to the original name, the terminal prompt also returned to normal.
This morning it's as shown above but the computer name is correct and has not changed.

I trashed the terminal preference file and repaired permissions (not that I thought it would help) and the prompt is still incorrect.

How to fix this? Where does the prompt get the computer name from? I presume it should automatically pick it up from the network settings or the computer name under sharing, but both those are correct.
And yes, I have rebooted, also no no avail.
I am looking through console logs, but don't see anything obvious yet.

Message was edited by: nerowolfe

Message was edited by: nerowolfe

MacBookPro3,1-17"Core2Duo/VistaUlt64SP1; MacBookPro1,1-15"/XPProSP3; Dual G5/XPP, Mac OS X (10.5.7), Homebrew 3GHz ASUS PC, Dell Inspiron8k, Abacus, Sliderule, HP-50G

Posted on Jul 10, 2009 9:53 AM

Reply
30 replies

Jul 12, 2009 2:40 PM in response to BobHarris

BobHarris wrote:
Well it seems simple enough. Stop using h and instead use:

PS1="$(systemsetup -getcomputername | awk '{print $3}'):W u$"

No, that simply masks the problem like sweeping dust under the rug.
As I have pointed out, I solved the problem - it was a router issue which I addressed and resolved.
You see, the original question I posited is where the name "new-host" was coming from since that is an issue. The answer, of course, is that it was from my router, and after discovering the whyfores, I fixed it.

Had I changed the prompt as you indicate, I would not have been aware of the issue, not to mention why the prompt should all-of-a-sudden need to be changed when it had been working properly for years, on all my computers.
A problem is solved, not by giving in to it, or applying a bandaid, but rather by going after the root cause and solving it, which I did.

Message was edited by: nerowolfe

Jul 12, 2009 4:41 PM in response to ericmeyers

ericmeyers wrote:
Um, why did your router cause it? The details are important for anyone else that may encounter the same issue.

Eric

I can only surmise, but It appears that because the MBP Ethernet and AirPort connections are essentially independent and their MAC addresses are different, that the router DHCP was forced to assign a new name (and IP address) to this computer when I turned on AirPort.
In this case it seems to be vice-versa since the AirPort connection was first.

In the Router GUI, the correct computer name was displayed along with the other data for that computer, labeled as Wireless.
The second, incorrect name, "new-host," was displayed with a new IP and new name and designated as Ethernet in the router GUI.

Whether something new with Leopard in a recent update or not, I don't know, but apparently my router allows both WiFi and Ethernet connections to exist simultaneously, considering them separate machines, and the common name forced the router to create its own new name to resolve the conflict.
I believe that Leopard only allows one connection to be active at a time, and that was the "new-host" name, which Terminal picked up.

The clue was when I unplugged the Ethernet cable with AirPort turned off and the Terminal prompt immediately changed back to the correct one.

As I noted, just a

Jul 12, 2009 4:47 PM in response to nerowolfe

True, but when I wrote that, you had not found the root cause of your problem.

And my experience with funny system names, as I explained, came from the company DNS servers associating their own DNS name to my Mac, which no one in their right mind would want to use. So I personally just force my PS1 to use the Bonjour name I give my Mac via System Preferences -> Sharing -> Computer Name. Other systems that have Bonjour (or zeroconf) installed can access my system on the same subnet via myname.local which is perfectly OK with me. Of course those *Other Systems* are me from my other Mac I have at work 🙂

It is nice to know the root cause, and especially if you have control of all your networking gear. In my case I do not have that control.

And you never know, someone else may have a similar situation to mine, and find the combination of the * systemsetup -getcomputername* command you found, and my suggestion to use it in the PS1 variable useful.

Jul 12, 2009 5:28 PM in response to ericmeyers

ericmeyers wrote:
That's a quirk in the router. My Netgear uses the same hostname for different ethernet interfaces in the same machine without issue.

Is it an Airport router?

Eric

It's a Verizon FIOS router, actually an ActionTech MI424WR rev. E.
It might be the router, but, when you say your router uses the same hostname for different internet interfaces, what happens when both Ethernet and AirPort are on simultaneously from the same machine? It should not assign the same computer name to both connections.
I think I usually turn off the Ethernet before turning on AirPort and vice-versa, but I think sometimes I have both on and this is what I think caused the problem. As far as the router is concerned, it sees a new computer with a new MAC and a name that is currently being used, so it creates a new name. This would not seem to me to be unusual behavior. The router has no real way of knowing that both DHCP requests come from the same computer, and even then, I am not sure what it can do other than give a new name to the "new" computer.
I will be careful in the future to not leave both Ethernet and AirPort on simultaneously, except for testing to see if this is indeed what happened/happens.

Again, this might be related to a Leopard update which allows both Ethernet and AirPort to be on at the same time. I think this was not always the case, but I might be mistaken.

Message was edited by: nerowolfe

Jul 12, 2009 5:39 PM in response to nerowolfe

There is nothing wrong with the same hostname on different interfaces. This is normal. As long as it's machine unique.

Your computer notifies the DHCP server of it's recommended hostname when it contacts it.

As long as you get a different IP for each interface then it's OK.

Why the Verizon refuses the same hostname is a mystery, but your workaround is fine.

Eric

Jul 12, 2009 7:40 PM in response to ericmeyers

ericmeyers wrote:
There is nothing wrong with the same hostname on different interfaces. This is normal. As long as it's machine unique.

I beg to differ. If two machines are found on the same LAN with the same name, one has a (2) appended to the name. There cannot be two machines on the same LAN with the same hostname, for obvious reasons. When you access the machine by hostname from a third machine, and two others have identical names, which one would you get? No, two machines on the same network cannot have the same hostname, which is exactly what my router did when it found that situation.
Or simply consider the third machine showing two identical names in Finder under Places. It's just not allowed.
Your computer notifies the DHCP server of it's recommended hostname when it contacts it.

As long as you get a different IP for each interface then it's OK.

Again, no, since the machines can be accessed by hostname and the router would not know which one to give you.
Why the Verizon refuses the same hostname is a mystery, but your workaround is fine.

I don't see it as a mystery. I simply won't have both Ethernet and AirPort turned on at the same time on the same machine anymore.
Eric


Message was edited by: nerowolfe

Jul 13, 2009 7:04 AM in response to nerowolfe

Bonjour is a very complicated system.

The daemon process which sets the hostname is "configd". If there is no dedicated DNS server on your network, then configd will use mdns/Bonjour to determine the hostname. I don't know any detail of Bonjour; the followings are just my guess.

On my home network, I have a wireless router which also has some ethernet ports. I first connected my iMac to the network via AirPort. The hostname is set to "iMac.local", where 'iMac" is the name I set in the Sharing Preference pane. The ".local" indicates this is a Bonjour name. Then I connected the iMac also via Ethernet cable (AirPort is still on, and the ethernet interface has a different IP address from AirPort). The log from configd reads:

Mon Jul 13 22:47:55 iMac configd[14] <Info>: network configuration changed.
Mon Jul 13 22:47:55 iMac configd[14] <Info>: hostname (multicast DNS) = iMac

and the hostname remains "iMac.local".

When the ethernet cable is connected, the iMac starts to use it instead of AirPort since it has higher precedence than AirPort in the Network Preference. The first thing the iMac does is to multicast that it wants to use "iMac" as the hostname and confirm that there is no other host (or interface) which uses the same name. At this point, the AirPort interface responds that it also use the name "iMac". But both packets (from Ether and Air) seem to have Kerberos ID which identifies their origin. These IDs agree with each other, so I guess Bonjour software decides that it is OK to use the same name for the two interfaces. Only my guess.

You can watch the packets by using tcpdump, for example:

$ sudo tcpdump -vvv -s 0 port mdns


In order to read the log from configd, you need some trick.
configd sends the info to syslogd with facility/level = Daemon/Info, but they are ignored by syslogd by default, as seen from the following:

$ syslog -c syslogd
ASL Data Store filter mask: Emergency - Notice

this means the level Info (lower than Notice) is filtered out (ignored). To tell syslogd to accept all the levels:

$ sudo syslog -c syslod -d

Then you can watch the log from configd by

$ syslog -w -k Sender configd

This will print the last 10 messages (if there are), and wait for new messages. Hit ctrl-C to quit.
Be sure to set the filter level back to the original:

$ sudo syslog -c syslogd -n


See manpages for syslog(1) and syslogd(8) for more info. Or you can edit /etc/syslog.conf if you are familiar with the "ordinary (=non Apple)" syslogd.

Jul 13, 2009 12:37 PM in response to ericmeyers

ericmeyers wrote:
You need to read what I posted more closely. I clearly said machine unique. Interfaces on the same machine can use the same hostname.

I never said 2 machines with the same hostname.

Then why are you posting in this thread?
Please reread my Subject: and followup. You are off-topic.
I believe that I am not being difficult but this thread is marked answered.

Jul 13, 2009 12:39 PM in response to Jun T.

Jun T. wrote:
Bonjour is a very complicated system.


As I noted, this thread is solved. The problem has nothing to do with BonJour, as you will see if you read my posts and the subsequent solution - the detailed description of the problem, its cause and its resolution.
We are beating a very dead horse here and AFAIAC, this thread is closed.

Jul 13, 2009 1:18 PM in response to nerowolfe

It is a Bonjour/DNS issue, or more specifically a side-effect of how configd dynamically determines the hostname based on a series of criteria including the reverse DNS record associated with the active interface's IP address, or the configured Bonjour (mDNS) name if available, or simply the name 'localhost' if nothing can be discerned from the network.

Jul 13, 2009 8:47 PM in response to nerowolfe

The problem has nothing to do with BonJour

Yes, I konw, you are using DNS.
I just wanted to point out that, unlike true DNS, Bonjour/mdns allows two interfaces of a host to have the same hostname (even if their addresses are different, and even if both are simultaneously active). Sorry for my bad English, and sorry for posting to a closed thread.

Terminal prompt machine name changed to "new-host"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.