24

I can't connect to mirrordirector.raspbian.org in Raspbian, but I don't know why.

I've already re-installed Raspbian, but it looks like this is not the problem. How can I resolve this?

After I connected to my Raspberry Pi over SSH from another computer and then run sudo apt-get update and work like a charm. But, if someone can explain why it wasn't working when I was executing the command from the Pi itself, it would be great!

Aurora0001
  • 6,308
  • 3
  • 23
  • 38
William Bello
  • 343
  • 1
  • 2
  • 6

7 Answers7

28

This Answer is obsolete. The operation of mirrordirector has changed.

Using terminal or your favorite text editor you can define a specific mirror to use in

 /etc/apt/sources.list

Just comment out the line

 deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware

So it looks like this

 #deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware

And replace with a mirror close to you from list below

The list of mirrors can be found here

I (being in the US) use the lease Web mirror

Update

Problem seems dns related (except for slow ping when you used actual ip of Google.

Update your /etc/network/interfaces eth0 line to include (or update existing) to be (as last line of section)

 dns-nameservers 8.8.8.8 8.8.4.4

Those are Google name servers. Just to see if get better performance. If you would like less prying eyes than Google, there are other free providers out there.

As far as slow ping when pinged ip address of Google, I would reboot router and/or modem.

Update 2

If adding to /etc/network/interfaces didn't work add the following as last line of /etc/resolv.conf

 nameserver 8.8.8.8 8.8.4.4

And then restart or just restart networking

Edit 3 Also if you could update answer with output of

 ifconfig

You do this via terminal. It will show us the local address of the Pi. Also, please update answer with local ip of computer that is working, or the local address of the router. For example mine is

 192.168.1.1
Milliways
  • 59,890
  • 31
  • 101
  • 209
geoffmcc
  • 621
  • 5
  • 8
  • thanks for your answer!, but that does not solve my problem. It's doing the same as before. Just trying to connect to get the package but stock on 0% and I'm also unable to ping google.com. Do not why – William Bello Feb 10 '15 at 13:15
  • Wired or WiFi? Did Internet work during install. Can you ping your router or any other local device. – geoffmcc Feb 10 '15 at 13:18
  • wired connection. And Yes I can ping local devices but really do not know if it was working during install, cause I did not need internet connection while installing. – William Bello Feb 10 '15 at 13:37
  • Seems like a dns problem. Can you ping 74.125.29.138 (Google IP) – geoffmcc Feb 10 '15 at 14:02
  • Yes, but then stop for a while (almost 2 minutes) and then continues the ping. – William Bello Feb 10 '15 at 14:07
  • Okay. I'm going to update my answer so we keep comments less. One last thing I failed to ask. Can you access sites in browser? – geoffmcc Feb 10 '15 at 14:08
  • I use startx in order to get to the GUI and open browser and it say "Opps! It was not possible to show this website". Excuse me if that's not the proper way for pro'people, but I did it that way cause I'm a noob. Thanks for the answer. – William Bello Feb 10 '15 at 14:17
  • Yes. Definitely dns. Try my answer and if that don't fix it (after a reboot) there may be a resolve.conf file we also have to add dns to. If you know terminal, rather than restart you can also do sudo service networking restart – geoffmcc Feb 10 '15 at 14:20
  • It still doing the same :(. – William Bello Feb 10 '15 at 14:35
  • I already had the nameserver on the resolve.conf. And that's do not solve my problem. I do not why is not working, is the first time that happened to me. – William Bello Feb 10 '15 at 14:46
  • Have you rebooted the router and/or modem? Are you using static ip or does router assign via dhcp? Update your question with your /etc/network/interfaces content if you would not mind. I assume your writing this on same network so it can't be isp related. – geoffmcc Feb 10 '15 at 15:35
  • @William I see you accepted answer, just wondering what portion food it for you? Since you never added updated info to answer I assume was modem/router reboot, or the Pi had an address in a different range than your network such as 192.168.2.x where should have been 192.168.1.x. – geoffmcc Feb 10 '15 at 22:17
8

I suffered similar issue, and use this way to sovle it. First, comment out this in /etc/apt/sources.list:

#deb http://mirrordirector.raspbian.org/raspbian jessie main contrib non-free
deb http://apt.osmc.tv jessie main

then do sudo apt-get update and sudo apt-get upgrade. Then recover the sources.list

deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware
deb http://apt.osmc.tv jessie main

Do sudo apt-get update and sudo apt-get upgrade again. It no longer happen.

Gord Chen
  • 81
  • 1
  • 1
4

My solution was to disable IPv6 in the router.

  • 2
    This is not likely to be a permanent solution as the switch to ipv6 is coming. – Steve Robillard Dec 06 '15 at 10:21
  • 1
    Well, it's actually very likely and it helped me immediately. I have IPv4 provider and I had IPv4->IPv6 tunnelling (Automatic) enabled on my Netgear router. Disabling IPv6 so far did immediately fix the ping/nslookup request to mirrordirector.raspbian.org. – igraczech Nov 07 '16 at 21:24
  • This worked for me, although I'm eager for a permanent solution. – Ben Mar 05 '18 at 15:06
4

One way is to add following lines to /etc/hosts file

  1. Open /etc/hosts file with sudo rights $sudo nano /etc/hosts
  2. Paste the following lines at the end of /etc/hosts file

    93.93.128.193   mirrordirector.raspbian.org
    

    93.93.128.191 archive.raspbian.org

This works for me!!

Tanuj
  • 246
  • 2
  • 4
3

In my case (same behavior, no name server resolution) I fixed it by modifying the /etc/nsswitch.conf it only had files and dns was disabled. Now the hosts line is: hosts: files dns

  • This worked for me and many (all at the time of writing) others in this page did not. In the hosts: line in the /etc/nsswitch.conf file there was more than just 'files dns' and now it is just exactly those two and I am back in action. I have a perfectly fresh install of debian-stretch-raspbian on a new pi-0-w. – paul_h Nov 11 '17 at 14:35
1

I tried everything that geoffmcc provided but it still did not work for me. My solution was to change the DNS servers on my router. I used the OpenDNS name servers. enter image description here

I would imagine you can use the google name servers also as mentioned above. I would think that adding it to the resolve.conf or the interfaces file would work for some reason it didn't in my case. Hopefully this might help someone else.

villaa19
  • 111
  • 2
0

I tested my IPv6 connection using this site http://ipv6-test.com/ It said my IPv6 wasn't working. I found on a forum post that someone rebooted their router and it was fixed. I rebooted my router and the problem was fixed. The person who said to reboot the router had persistent problems had had to occasionally reboot the router. Also, the IPv6 test fails at my job. My job is at a company so big that the internet goes out of a different part of the country. Disabling IPv6 on your pi might work, but I think it's better to just fix IPv6 at the router level.

Russell Hankins
  • 201
  • 2
  • 7