Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-23-2005, 05:23 PM   #1
LQ Newbie
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16

Rep: Reputation: 0
/etc/hosts entry?

This is probably a really dumb question, but here goes: Whenever I login to Gnome in FC3, whether as root or another user, I get a message that says "localhost could not be found. Gnome programs may not function properly. Adding localhost to your /etc/hosts file may fix this problem." I of course added a line to my /etc/hosts file that says localhost, but that didn't work. I also removed every reference I could find to localhost in settings -- I think I called my computer "localhost" at some point; I'm not sure. Anyone know what's going on here?
Old 03-23-2005, 05:50 PM   #2
Registered: Apr 2004
Distribution: Gentoo
Posts: 37

Rep: Reputation: 15
You don't just add "localhost"

echo " localhost" >> /etc/hosts
Old 03-23-2005, 06:16 PM   #3
Registered: Mar 2005
Location: USA
Distribution: Knoppix
Posts: 64

Rep: Reputation: 15
Correct. You must have both the IP address and hostname in the hosts file because the file provides a way for the machine to map IP address to hostname. Therefore just having one or the other and leaving one of them out wont do.
Old 03-23-2005, 09:11 PM   #4
LQ Newbie
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16

Original Poster
Rep: Reputation: 0
Indeed, that solved it. Thanks a bunch.

Old 03-25-2005, 09:49 AM   #5
LQ Newbie
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16

Original Poster
Rep: Reputation: 0
Actually, I found out the hard way that putting " localhost" in your /etc/hosts is not good syntax. It seemed to work at first because the warning didn't appear when logging out/back in. But when you reboot the system, it completely hangs at sendmail startup and you have to get out your trusty rescue disk to save the day. The proper syntax, in fact, is localhost.localdomain.localhost localhost

That's what should be in /etc/hosts. If your host is not called localhost but is called SomethingElse, it should be localhost.localdomain.SomethingElse localhost
Old 03-25-2005, 01:22 PM   #6
Senior Member
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Code: localhost.localdomain.SomethingElse localhost
What's the SomethingElse for? localhost.localdomain covers everything that's needed, then the second localhost is the alias. Mine reads: localhost.localdomain amelie


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me: slowly booting when adding an entry in /etc/hosts jindo Linux - Networking 6 09-29-2005 10:45 AM
Correct entry for local machine in /etc/hosts Kropotkin Linux - Networking 1 11-16-2004 05:41 PM
hosts MX entry twistedpair Linux - Networking 1 01-10-2004 03:01 AM Entry in Zone file and /etc/hosts, will this cause probs? mikeyt_333 Linux - Networking 7 12-02-2003 02:51 PM
hosts entry for a lan unit with no dns entry linxtc Linux - Networking 1 10-03-2003 08:05 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration