I'm getting the below error when updating raspian. I connect via SSH via putty on the fixed wlan0 ip.

Now when i run sudo apt-get update i get errors like below.

Err http://raspberrypi.collabora.com wheezy Release.gpg Something wicked happened resolving 'raspberrypi.collabora.com:http' (-5 - No address associated with hostname)

I have been playing around with interfaces so i can fix (static my ip's) It may be related to that what is happening so im pasting my interfaces file below so you have a look. Thanks

auto lo
iface lo inet loopback

##--eth0 static ip configuration--##
#auto eth0
#allow-hotplug eth0
#iface eth0 inet static
#               address
#               netmask
#               network
#               broadcast
#               gateway

##--eth0 dinamic ip configuration--##

allow-hotplug eth0
iface eth0 inet dhcp

##-- wlan0 static ip configuration-- ##
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
        wpa-ssid "my ssid"
        wpa-psk "my password"
  • Looks like something is wrong with dns mechanism. 1. Try pinging google. If it's not working, it's surely a "resolv" problem. 2. Change static to dhcp momentarily, reboot to make it effective and see if it works. Commented Jun 24, 2015 at 13:50
  • I connect only via ssh , will i be able to connect after setting wlan0 to dhcp ? Commented Jun 24, 2015 at 13:52
  • 1
    @JorgeVidinha sure you can connect via SSH when using DHCP, but the trick is to find the IP address to use because it might change after each OS start-up. I say might because you can reserve some fix IP address based on MAC address on a DHCP server, so it is still possible to have the same IP address when using DHCP.
    – Huygens
    Commented Jun 24, 2015 at 14:11

2 Answers 2


You don't have to change to dhcp.

cat /etc/resolve.conf should show you which dns servers are currently configured.

As dastaan said, you can just type ping google.com to see if you are resolving basic addresses. You can also use nslookup google.com

To add a dns server w/o changing your permanent setup, just add the entries to /etc/resolv.conf. This should reset when you reboot. The below will use the google dns servers.


Adding it permanently is a different animal. I would edit /etc/network/interfaces and under the wlan0 block add the following line:

  • Added the resolve.conf file with google dns that was missing , added the last line under wlan0, in meantime deactivated eth0 and its now working with wlan0. And learned that although eth0 is commented on both static and dinamic modes on /network/interfaces file every time i connect the LAN cable it receives a dynamic IP anyway. Is this expected ? This is probably another question Commented Jun 24, 2015 at 21:37
  • 1
    @JorgeVidinha you should not edit /etc/resolv.conf as your changes will be lost (on Debian-based systems). Adding the dns-nameservers line ought to be enough. Note: that using Google's DNS might have privacy issue. So choosing carefully your DNS server is important to protect yourself.
    – Huygens
    Commented Jul 7, 2015 at 21:05
  • I did it still getting error: stackoverflow.com/questions/45531150/…
    – AskMe
    Commented Aug 6, 2017 at 11:34

Usually via DHCP you get also the names of the DNS servers to use so that you Debian/Raspbian can automatically configure them in order to resolve hostnames into IP addresses (and vice versa).

When you go static you need to specify it. On recent Debian/Ubuntu, this is done like follow, and I believe that this would be similar on Raspbian.

Add an extra line to your interfaces configuration for your wlan0:

dns-nameservers <dns names separated by spaces>

(e.g. dns-nameservers but use your DNS server(s)).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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