0

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

root@valk-pc:~# nslookup localhost
Server:     10.0.0.138
Address:    10.0.0.138#53

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

My /etc/resolv.conf has this:

# Generated by NetworkManager
domain siemens
search siemens
nameserver 10.0.0.138

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

1

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:-

127.0.0.1   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...

  • 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
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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