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

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at
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:       localhost.localdomain   localhost       rceng02.eng.lan rceng02

Or:       rceng02.eng.lan rceng02 localhost.localdomain   localhost

This is not:	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 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:
TLUG requests: Linux topics, No HTML, wrap text below 80 columns

More information about the Legacy mailing list