[CentOS] /etc/hosts missing localhost?

Tue Jul 22 21:08:01 UTC 2008
Bill Campbell <centos at celestial.com>

On Tue, Jul 22, 2008, Rudi Ahlers wrote:
> Bill Campbell wrote:
>> On Mon, Jul 21, 2008, Jim Perrin wrote:
>>   
>>> On Mon, Jul 21, 2008 at 9:20 PM, Bill Campbell <centos at celestial.com> wrote:
>>>     
>>>> Is there any reason why /etc/hosts would be missing the line,
>>>> 127.0.0.1 localhost?
>>>>       
>>> Nope. It's there by default in some form or another.
>>>
>>> By default, it usually looks like this ->
>>>
>>> 127.0.0.1       installname  localhost.localdomain  localhost
>>> ::1          localhost6.localdomain6   localhost6
>>>
>>> If you don't have anything like this in your /etc/hosts, you either
>>> need to find a mirror and begin yelling at responsible parties, or
>>> stalk whomever else has root on this particular machine.
>>>     
>>
>> I guess I could yell at myself as I'm doing kickstart installs from
>> a local mirror.
>>
>> I found the same thing on two CentOS 5.1 installs here, one on a
>> VMware VM, the other on real iron.  The wierd thing is that the
>> base VMware VM I have that I copy to create new VMs looks OK.
>> Now I'm going to have to poke around to see what's causing this
>> line to be deleted.
>>
>> Bill
>>   
> I had a similar problem using OpenVZ images, installed from kickstart -  
> almost like it's leaving some stuff out by default. So I ended up  
> creating the file manually and adding it to the kickstart file to be  
> copied over.

The file was OK after the kickstart install, and after a ``yum update''.
We install about 240 packages under the OpenPKG portable package management
system which may have caused this, but I have not seen this problem prior
to CentOS 5.2.

I did not check to see the status of the /etc/hosts file after configuring
the network with system-config-network, and before installing OpenPKG and
its packages.  I may create a new VM, and run through the network
configuration etc. to see where this is happening (VMware snapshots and
revert sure simplify things like this :-).

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

Early in life I had noticed that no event is ever correctly reported
in a newspaper. -- George Orwell