hostname always "localhost"

mmb

Registered
hey there-

an upgrade or 2 ago, I noticed that Terminal lost all sense of the machinename ("greenthing") and always reverts to localhost.

- the login screen correctly shows "greenthing" as the name.
- systemprefs -> sharing correctly shows "greenthing"
- /etc/hostconfig has this line in it:
APPLETALK_HOSTNAME=greenthing
- /Library/Preferences/SystemConfiguration/preferences.plist has greenthing set as the Network and System Hostnames

AND YET:

- in the terminal, my prompt, which should have the hostname, shows "localhost".
- "echo $HOST" returns localhost
- the command "hostname" returns localhost

if I do a "sudo hostname greenthing", it gets set correctly but does not survive a reboot.

what's going on? at the moment it isn't causing any problems, but has been a mystery for over a year now.

thanks!
mark

system info: g4 fw800, 10.3.7, shell=tcsh
 
Welcome to the forum :)

Quit Terminal
Go to Home>Library>Preferences.
Trash com.apple.Terminal.plist
Empty the trash
Open Terminal

See if that corrects things.
 
hey cheryl-

thanks for the reply!

unfortunately that didn't help....and I do know that terminal wasn't reading the prefs file because my shell returned to default font, coloring, etc....
 
In /etc/hostconfig change HOSTNAME to the name you want. APPLETALK_HOSTNAME would only be for AppleTalk networks.
 
hello-

that did it, adding the HOSTNAME line to /etc/hostconfig.... thanks!

looks like an automatic system update changed that file pretty dramatically and broke it as well; there's an auto-generated hostconfig.old file there from Nov 2002 that has this line in it:

HOSTNAME=-AUTOMATIC-

I did hardwire in the hostname in the hostconfig file, as opposed to using -automatic-....

just to doublecheck, whereas the hostconfig.old file was purely ASCII, the current one has some non-printable control characters on the first and fifth lines. in vi looks like:

??b^A??P|?/???

is that normal, or did this file get corrupted at some point?

thanks again!
mark
 
Hmm, I don't have any unprintable characters in mine. The file is updated when you change stuff in the control panels, did you have System Preferences crash on you at some point?

If it's not causing any problems for you, it's probably OK.
 
no crash that I know of, but something definitely went weird with that file (probably the same reason it lost the hostname line).

just cleaned up the file and rebooted; everything appears fine...

best,
mark
 
Back
Top