Ok, I've got a feeling that this is an uber-n00b question, but I've followed advice on the Wiki, and on threads here... but it still doesn't work for me.
I've set HOSTNAME in /etc/rc.conf:
(ok, "meme" isn't my real hostname, but I'm using it here to avoid confusion)
And in /etc/hosts:
#<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 localhost.localdomain localhost 127.0.0.1 meme.localdomain meme
I rebooted, and when I started XFCE, I got an error that XFCE can't find a internet address for myhost and suggested adding myhost to /etc/hosts.
I looked at /etc/logs/messages.log, and it started logging everything with "meme" instead of "myhost", so I know that I'm getting close. But $HOSTNAME is still "myhost".
Any help would be greatly appreciated.
The second line in your /etc/hosts file is not required. Change it to the following:
#<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 localhost.localdomain localhost meme
That, along with the setting in your /etc/rc.conf file, should set your hostname correctly, stop the error in XFCE and display your correct hostname when you type the command hostname in a terminal.
Last edited by steven (2007-07-21 18:49:41)
Um... I just tried that... and still no go . I still get the XFCE error, and the command hostname spits back 'myhost'.
Is there something I'm missing here? I've got a feeling that it's something incredibly obvious ...
Ah sorry, my bad - the /etc/hosts file should read:
#<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 meme.localdomain localhost meme
Notice meme.localdomain instead of localhost.localdomain.
I'm sorry to say, but it's still not working for me. (I edited /etc/hosts and rebooted) I really don't know what in the world is up with my system... it's as if my hostname got frozen on myhost and it won't change...
Nevertheless, I appreciate your help, steven.
Bizarre, I'm sure I haven't missed anything. I remember only needing to change the HOSTNAME in rc.conf and editing my /etc/hosts file, as shown above. I originally had the same error when starting XFCE, setting my hostname correctly in those two files did the job though.
When you type hostname in a terminal, what's the output?
For some reason, I booted my machine without the Ethernet cable plugged in... and the hostname changed. After a bit of digging around in my machine's and my router's settings, I finally figured that my network profile had a line 'HOSTNAME=myhost'. By simply deleting this line from all my network profiles and rebooting, I've fixed my hostname problem.
Thanks for helping out, steven... your comments helped me narrow this problem down .
HOSTNAME="" should be a fully qualified domain name ie myhost.domain.org. Note the three entries seperated by a dot. Your hosts file should be similar:
127.0.0.1 myhost.domain.org localhost.localdomain localhost myhost
localhost.localdomain and friends are for program compatibility.