LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices

Reply
 
Thread Tools
Old 03-23-2005, 05:23 PM   #1
batard
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16
Thanked: 0
/etc/hosts entry?


[Log in to get rid of this advertisement]
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?
batard is offline     Reply With Quote
Old 03-23-2005, 05:50 PM   #2
gt_swagger
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 37
Thanked: 0
You don't just add "localhost"

echo "127.0.0.1 localhost" >> /etc/hosts
gt_swagger is offline     Reply With Quote
Old 03-23-2005, 06:16 PM   #3
soulstace
Member
 
Registered: Mar 2005
Location: USA
Distribution: Knoppix
Posts: 64
Thanked: 0
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.
soulstace is offline     Reply With Quote
Old 03-23-2005, 09:11 PM   #4
batard
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16
Thanked: 0

Original Poster
Indeed, that solved it. Thanks a bunch.

Batard
batard is offline     Reply With Quote
Old 03-25-2005, 09:49 AM   #5
batard
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Mandrake 10.1
Posts: 16
Thanked: 0

Original Poster
Actually, I found out the hard way that putting "127.0.0.1 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

127.0.0.1 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

127.0.0.1 localhost.localdomain.SomethingElse localhost
batard is offline     Reply With Quote
Old 03-25-2005, 01:22 PM   #6
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, OpenSuSE 10.1, FreeBSD/SPARC 6.0
Posts: 1,847
Thanked: 0
Code:
127.0.0.1 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:
127.0.0.1 localhost.localdomain amelie
Komakino is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
127.0.0.1 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


All times are GMT -5. The time now is 11:49 PM.

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