Debian upgrade gone wrong - hostname: Name or service not known

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Nov 4 23:39:51 UTC 2009


On Wed, Nov 04, 2009 at 02:57:58PM -0500, William O'Higgins Witteman wrote:
> Interestingly, though I got around this problem by stomping on netatalk,
> it is still broken and causing problems with amavis.
> 
> Symptom: 
> 
> # hostname 
>   returns the subdomain (this machine is a subdomain - this is as expected)
> 
> # hostname --fqdn [-f]
>   returns hostname: Name or service not known
> 
> /etc/hosts looks fine, as does /etc/hostname
> 
> This stopped working because of a dist-upgrade, no changes to any
> configurations.
> 
> How does "hostname" work?  Why could it be barfing?  Thanks again.

Perhaps your /etc/hosts is not valid.

Something like this is proper:

127.0.0.1       localhost.localdomain   localhost
127.0.0.2       rceng02.eng.lan rceng02

Or:

127.0.0.1       rceng02.eng.lan rceng02 localhost.localdomain   localhost

This is not:

127.0.0.1	mybox

The first entry after the IP _must_ include the domainname, at least
if it happens to be the hostname of the box.  Things that are not the
hostname don't require this.

So essentially whatever your hostname is, there must be an entry in
/etc/hosts with an IP, the hostname with domain, and the hostname by
itself, in that order.  Since 127.0.0.1 should always be there, and
never changes, it is a handy place to put the official hostname.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list