2

I have the following problem.

I am using my RaspBerry (with RaspBian installed) by SSH.

My problem is that I can't use wget command because it fails.

For example if I try to execute the following command:

sudo wget http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg

I obtain this error message:

--2014-05-29 19:39:11--  http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg
Resolving dietrofuoritempo.files.wordpress.com (dietrofuoritempo.files.wordpress.com)... failed: No address associated with hostname.
wget: unable to resolve host address `dietrofuoritempo.files.wordpress.com'
pi@raspberrypi ~/driverWireless $ sudo wget http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg

The strange thing is that I can ping it:

pi@raspberrypi ~/driverWireless $ ping dietrofuoritempo.files.wordpress.com
PING dietrofuoritempo.files.wordpress.com (192.0.80.175) 56(84) bytes of data.
64 bytes from dietrofuoritempo.files.wordpress.com (192.0.80.175): icmp_req=1 ttl=41 time=164 ms
64 bytes from dietrofuoritempo.files.wordpress.com (192.0.80.175): icmp_req=2 ttl=41 time=167 ms

Why? What can I do to solve this issue?

(on my Ubuntu Linux system I have no problem to perform wget command)

  • 1
    Have you tried the wget command without using sudo? Not sure why sudo would change ability to resolve DNS requests. Are you using any proxy settings? sudo would remove those environment variables holding the proxy settings. Hmmm – lornix May 29 '14 at 18:03
  • Is this a private IP? I looks like your requesting data from an internal network. You could be missing a local DNS server in hosts. Why ping works and not wget... it could just be a DNS server replying to the ICMP request, instead of the intended host. Try replace the host with IP instead and request path the same. - but its likely to fail since it looks like a multi tenant address. try traceroute . sudo apt-get install traceroute then traceroute [ip/web-site url] see what is going on. – Piotr Kula May 29 '14 at 18:37
  • It's not a great idea to run wget as root. Imagine someone hacks the target website and puts a malicious file there that targets a bug in wget. Now they have a root shell on your system. – John La Rooy May 29 '14 at 22:51
  • Hello @AndreNObili - Did you try any of these? – Piotr Kula May 30 '14 at 9:27
  • 1
    There are other commands you can use - e.g. curl http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg > bla-bla.jpg – Wilf Jun 2 '14 at 10:03
1

According to one of the answers to this serverfault question, check the contents of /etc/nsswitch.conf, my Pi has this entry for hosts:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

According to this document, mdns4 is Multicast DNS and [NOTFOUND=return] means any response of Not Found to the Multicast DNS request will be returned as authoritative prior to attempting a Unicast DNS request.

The article goes on to say that you can reverse the order of dns and mdns4_minimal to prefer legacy Unicast DNS over Multicast DNS as shown in the updated /etc/nsswitch.conf entry below:

hosts:          files dns [NOTFOUND=return] mdns4_minimal mdns4

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.