I am trying to install tightvncserver on my rPi model A running Raspbian. I am connecting to the rPi via SSH from my laptop. I can connect to the internet, but cant install the package. It seems to be a problem with mirrordirector.raspbian.org because that is where my rPi runs into trouble. Is anybody else running into this issue or found a solution? Searching this site seemed to show that I am not alone in this, but I couldn't find a resolution.

I've tried

sudo apt-get update

Screenshot: Screenshot for sudo apt-get update

but it takes forever when trying to reach mirrordirector.raspbian.org Every time I try it says "XX% [waiting for headers]" for several(30+) minutes before finishing with an error message.

I've tried pinging mirrordirector.raspbian.org with both my rPi and laptop, and both tell me its unreachable. When I try to go there with my browser(on laptop) it gives me error 504 gateway timeout.

Edit: I tried wget mirrordirector.raspbian.org and it gave me a 504 error... Is anybody else getting this error? wget output on rPi

Should I change my sources.list file? it contains

deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free r$

  • when i manually tried to visit the pages, i got the same problem as yours might be your Pi is out of memory or your memory card got corrupted i had the same issue, i solved this with another memory card(i expanded the momory partition) see this link in here – Ruthvik Vaila Nov 8 '13 at 14:37
  • I have the same issue. Do you use a Netgear router? – Vreality Jan 28 '14 at 21:37
  • The question is old but I had same problem today of being able to ping but not to get data with wget also from google.com so here my solution: after a lot of trials just to give it a try I've launched rpi-update and it worked, then after a reboot also apt-get started working. Seems crazy but so that was – Andrea Giovacchini Feb 21 '15 at 23:37
  • Be sure to check that there is not a firewall rule blocking your attempted connection. – anonymous164937 May 25 '15 at 3:07
  • It may be worth noting the list of Raspbian mirrors - of relevance/explanation also is the paragraph that mentions that: "The mirror redirection system is available at mirrordirector.raspbian.org . It provides the same files as archive.raspbian.org and can be used in apt sources etc. It is powered by mirrorbrain and will automatically direct requests to a suitable (and hopefully local) mirror (note: for technical reasons not all files are redirected). " MirrorBrain is a FOSS project. – SlySven Jan 18 '17 at 5:07

Please note this answer is out-of-date and the current version of Raspbian is jessie, not wheezy. Make sure of which one you are using before you do anything.

Your raspbi could not find a valid mirror so you need to find a working mirror. For valid and working mirrors please check http://www.raspbian.org/RaspbianRepository

After getting valid mirror address you need to add this mirror url to your /etc/apt/sources.list

for example your sources.list file should look like

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

and then you need to update apt sources

sudo apt-get dist-upgrade

finally update your raspbian or do whatever you want

sudo apt-get update

I had a similar problem. It turned out that the network I was on required http requests to go through a proxy.

Usually typing the following before accessing the web will work:

pi@raspberrypi ~ $ export http_proxy="http://username:password@host:port/"

(where username:password are your username and password on the proxy, host is the name of the proxy and port is the port on the proxy. If you don't need to login to the proxy, you can leave off the username:password@ part.)

But it turns out that apt-get doesn't understand the http_proxy variable (for security reasons.)

Instead I followed the directions at http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=18634

pi@raspberrypi ~ $ cd /etc/apt/apt.conf.d/
pi@raspberrypi /etc/apt/apt.conf.d $ sudo nano 10proxy

Within the nano editor type the following line:

Acquire::http::Proxy "http://username:password@host:port";

Then use ^X (Ctrl-X) to save and exit. Now

sudo apt-get update

should work.


Hello I had the same problem , I found out that in my case it is my netgear router which is blocking all ip adresses in range 5.x.x.x
so raspbian.org is blocked (I also tried www.pure.com) same result netgear is abusing range 5.x.x.x for readycloud function , very bad !!! I solved it by using wifi access in other place (without netgear router)

  • 1
    Is there any way to disable this utterly horrible "feature" on the router? – Vreality Jan 28 '14 at 21:37

Some of the answers to this question are out-of-date now that the current version of Raspbian is jessie, not wheezy.

The content of /etc/apt/sources.list has changed accordingly. Here it is as it appears in the 2016-09-23 image:

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

I had this problem with mirrordirector.raspbian.org and solved it by uncommenting the last line. Strangely, this was only necessary on one of the two SD cards I installed.


I had the same(?) problem with mirrordirector.raspbian.org. I booted a new image and made a wifi connection while in the raspi-config gui. I logged out to the console and tried apt-get. No luck. In fact no internet at all. Exiting the gui killed the connection. I rebooted and this time internet working, apt-get working.


I had the same issue and found that the issue was that my /etc/resolv.conf was pointing the nameserver to an old IP address that was previously used by a workstation on my network (No idea why) after correcting that to my DNS server on my network all was wel


Please note this answer is out-of-date and the current version of Raspbian is jessie, not wheezy. Make sure of which one you are using before you do anything.

  1. sudo nano /etc/apt/sources.list
  2. clear all line and add

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free

deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

  1. exit and save CTRL-X
  2. sudo apt-get upgrade
  3. sudo apt-get update
  • Why do you think this is the problem? – Steve Robillard Oct 10 '16 at 13:09
  • I think there is a problem when installing source previous programs – Hamed Oct 10 '16 at 13:17

protected by Community Jan 13 '17 at 11:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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