49

I am getting this strange thing on my Ubuntu 12.04 64-bit machine when I do a wget

$ wget google.com

--2014-07-18 14:44:32--  http://google.com/

Resolving http (http)... failed: Name or service not known.

wget: unable to resolve host address `http'

I have encountered this problem earlier when I got it for any web pages (and not http), which required me to add my nameserver to /etc/resolv.conf.

However, here that doesn't seem to be the problem, instead it is recognizing http as something different. Any advise?

kausal_malladi
  • 1,542
  • 3
  • 14
  • 30
  • can you ping google.com? – ChrisBint Jul 18 '14 at 09:28
  • you won't be able to wget anything then. You have an issue with your nameserver configuration. As @WhiteCoffee suggests below, add in the google public DNS servers and try to ping then. If that works, wget should work. – ChrisBint Jul 18 '14 at 09:39
  • You cannot use ping for some proxies. Nor can you use a DNS lookup from the client in question. Some corporate networks do not allow external resolution. The proxy server must handle that. I suspect in @techEnthusiast's case, the proxy is required to handle the DNS. – rjenkins Nov 23 '15 at 22:16

7 Answers7

73

The DNS server seems out of order. You can use another DNS server such as 8.8.8.8. Put nameserver 8.8.8.8 to the first line of /etc/resolv.conf.

whitecoffee
  • 957
  • 6
  • 8
  • 2
    why exactly 8.8.8.8 – Mouin Jan 04 '17 at 09:13
  • 8
    @Mouin 8.8.8.8 is the [Google public DNS](https://en.wikipedia.org/wiki/Google_Public_DNS) which is a common used server, if you are looking for a open/democratic one have a look at: https://www.opennicproject.org/ – Mehdi Nellen Apr 11 '17 at 12:10
15

remove the http or https from wget https:github.com/facebook/facebook-php-sdk/archive/master.zip . this worked fine for me.

Sterling Archer
  • 22,070
  • 18
  • 81
  • 118
9

I have this issue too. I suspect there is an issue with DigitalOcean’s nameservers, so this will likely affect a lot of other people too. Here’s what I’ve done to temporarily get around it - but someone else might be able to advise on a better long-term fix:

  1. Make sure your DNS Resolver config file is writable:

    sudo chmod o+r /etc/resolv.conf

  2. Temporarily change your DNS to use Google’s nameservers instead of DigitalOcean’s:

    sudo nano /etc/resolv.conf

Change the IP address in the file to: 8.8.8.8

Press CTRL + X to save the file.

This is only a temporary fix as this file is automatically written/updated by the server, however, I’ve not yet worked out what writes to it so that I can update it permanently.

Aatif Akhter
  • 2,126
  • 1
  • 25
  • 46
6

I figured out what went wrong. In the proxy configuration of my box, an extra http:// got prefixed to "proxy server with http".

Example..

http://http://proxy.mycollege.com

and that has created problems. Corrected that, and it works perfectly.

Thanks @WhiteCoffee and @ChrisBint for your suggestions!

kausal_malladi
  • 1,542
  • 3
  • 14
  • 30
2

If using Vagrant try reloading your box. This solved my issue.

Dan Walters
  • 1,218
  • 1
  • 18
  • 30
0

It might happen because of the overriding of resolv.conf, This answer helped me, use below every time when you set up a new WSL. sudo chattr +i /etc/resolv.conf - will make the file immutable and won't be overwritten next time you start wsl.

sudo bash -c 'echo -e "[network]
generateResolvConf = false" > /etc/wsl.conf
rm /etc/resolv.conf
echo -e "options timeout:1 attempts:1 rotate
nameserver 1.1.1.1
nameserver 1.0.0.1" > /etc/resolv.conf
chattr -f +i /etc/resolv.conf'
Subodh Wasankar
  • 309
  • 2
  • 6
0

I had the same issue, I just removed the http:// from the link and it worked:

!wget www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz