Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

after installing anew Ubuntu 11.04 can't resolve to localhost. I'm trying:

root@valk-pc:~# nslookup localhost

Non-authoritative answer:
*** Can't find localhost: No answer

My /etc/resolv.conf has this:

# Generated by NetworkManager
domain siemens
search siemens

And /etc/hosts contains a valid localhost entries. What can be done? Thanks!

share|improve this question

Not being able to resolve localhost with nslookup is probably normal - it's specifically for querying nameservers, and unless the nameserver you're querying has a record for localhost, you won't get a response.

On Linux (and any other UNIX-alike system), you'll find an entry for localhost in /etc/hosts:-   localhost

Not sure why you're trying to resolve localhost, but if you're having problems, check in /etc/hosts first.

Edit: looking at your other post, I'm not sure why you're trying to look up localhost. If you can ping it, then resolving localhost isn't your problem...

share|improve this answer
I believe that something is wrong there. /etc/hosts is okay. And pinging from localhost is ok. Only when typing localhost in any browser, the problem is appearing. I was suggested to try nslookup localhost, and indeed the output is: Can't find localhost: No answer. – valk Dec 2 '11 at 20:35
Which, as I said before, you won't, because DNS servers are unlikely to resolve localhost. Do you have a system-wide proxy set? – Andy Smith Dec 2 '11 at 21:18
up vote 1 down vote accepted

At last I found this thread, and as it's there, in mine case as well, when I tried

sudo ping localhost 

then I got a correct answer.

So I tried changing /etc/hosts to

chmod 777

and it worked. Finally chmod'ed it to 644 and the problem is now resolved.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.