Name or service not known

From Helpful
Revision as of 17:45, 4 September 2012 by Helpful (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

...an error, with an errno of -2.

A host name lookup problem, and one that can have many different causes.


Before digging in to diagnose the problem, check the same thing on a different computer. If any test fails on other computers on the same network, it's likely to be a problem external to you (e.g. DNS server or proxy failing, or such).



Possible causes / things to look at

Nonsense lookup

If a hostname lookup is being done that makes no sense, for example gethostbyname() on an URL instead of a hostname.

host can't look up itself

If one of the following fails (replacing hostx or your favorite resolving utility):

hostx localhost
hostx `hostname`

...then it's likely your /etc/hosts is broken, or possibly the hostname you have set (there are some extra details to this when you set an FQDN as your hostname).


nameserver / proxy trouble

  • If the above work but things like:
hostx google.com
hostx yourisp.com

...all fail, then it might be DNS trouble - including not having a DNS server set (in *nices, look at /etc/resolv.conf)


nsswitch

  • Another reason for things not to work -- or sometimes for them to have weird patterns of working and not working -- can be that your /etc/nsswitch.conf is malconfigured, or configured to include something that does not work consistently (see in particular its hosts: line).