2

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 192.168.1.51
#               netmask 255.255.255.0
#               network 192.168.1.0
#               broadcast 192.168.1.255
#               gateway 192.168.1.1


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

allow-hotplug eth0
iface eth0 inet dhcp


##-- wlan0 static ip configuration-- ##
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
        address 192.168.1.50
        netmask 255.255.255.0
        network 192.168.0.0
        gateway 192.168.1.1
        wpa-ssid "my ssid"
        wpa-psk "my password"
3
  • 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. Jun 24, 2015 at 13:50
  • I connect only via ssh , will i be able to connect after setting wlan0 to dhcp ? 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
    Jun 24, 2015 at 14:11

2 Answers 2

3

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.

nameserver 8.8.8.8
nameserver 8.8.4.4

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

dns-nameservers 8.8.8.8 8.8.4.4
3
  • 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 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
    Jul 7, 2015 at 21:05
  • I did it still getting error: stackoverflow.com/questions/45531150/…
    – AskMe
    Aug 6, 2017 at 11:34
3

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 12.34.56.78 12.34.56.79 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.