[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: where is /etc/hosts supposed to come from?



On Dec 29, 2009, at 8:46, Vincent Bernat wrote:

> OoO En ce  doux début de matinée du mardi 29  décembre 2009, vers 08:34,
> je disais:
> 
>>> Details in <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316099>. I 
>>> do wonder, however, why the system hostname has to appear in /etc/hosts 
>>> at all? Programs that want to find it out can read /etc/hostname 
>>> directly, after all. And wtf is 'localdomain' for, anyway?
> 
>> A common way to get hostname is to request node name through uname, then
>> asks  for a resolution  of this  name. If  the name  does not  appear in
>> /etc/hosts, this will lead to a DNS resolution and without network, this
>> can take a long time.
> 
> And BTW, this is exactly what hostname -f does. It does not read /etc/hostname.

On one of my machines apticron uses a call to hostname -f, which fails, while uname -n succeeds. 

Perhaps it should be a bug to use hostname -f since it unreliable?

Jeremiah

Reply to: