LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-23-2005, 05:23 PM   #1
batard
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
gt_swagger
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 37

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

echo "127.0.0.1 localhost" >> /etc/hosts
 
Old 03-23-2005, 06:16 PM   #3
soulstace
Member
 
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
batard
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.

Batard
 
Old 03-25-2005, 09:49 AM   #5
batard
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 "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
 
Old 03-25-2005, 01:22 PM   #6
Komakino
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:
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
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:16 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration