Sample error:

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/i18n/Translation-en Unable to connect to

Now this was working just fine until I changed the IP this morning. I have the server set to a static IP of and for years it has been - the IP apt-get is trying to use right now. I use privoxy and tor thus the 8118 port.

Like I said it all worked until I changed the static IP from to I was forced to do so because of router issues. (Long and involved story, I didn't really want to change the IP because I know something like this would happen.)

The setup for TOR/Privoxy requires that has you point Privoxy at TOR via Then point curl, etc to Privoxy via $HOME/.bashrc. Typically you would set the listen to IP for Privoxy to but if you want it accessible to the rest of the LAN you set the IP to the server's LAN IP. Which I did a long time ago and was working fine until this morning. I have changed all instances of to in both /etc/privoxy/config and $HOME/.bashrc.

What makes this really strange for me is that curl is working fine. I curl icanhazip.com and voila I get a new IP every 10 minutes or so. I curl CNN.com and I get the short but sweet permanently moved to www.cnn.com message I expect. Firefox works fine. Ping works fine. And I've tested all of this via Remote Desktop over my LAN. So the connection appears to be fine for everything except apt. I've also rebooted hoping that would clear from apt.

So the connection to the internet and DNS aren't an issue for these programs. And they are, as far as I can tell, using Privoxy/TOR just fine. The real irony here is that I've tried to open up Privoxy to go to Ubuntu's servers directly without going through TOR to speed up the downloads from Ubuntu (did this months ago).

So somewhere that I have not been able to find, apt has stored the IP And is no longer valid.

Thanks for the help

  • Braiam is on the right track, but you may need to look in other files in /etc/apt to see where you set the proxy. I suggest grep 8118 -r /etc/apt as a wider search. – Daniel Lawson Nov 3 '13 at 1:32

The problem is that you haven't changed the proxy values in the client. You should look into /etc/apt/apt.conf.d/ for the proxy and change it to

grep -i proxy /etc/apt/apt.conf.d/* /etc/apt.conf

This will give you an idea of where is the proxy ip set. Then open the file and modify the settings.

I believe that your environment variables are OK, since you can user CURL just fine.

  • The grep command you suggest comes back empty. – Gabe Spradlin Nov 2 '13 at 23:07
  • Where did you run it? In the same machine that is throwing you the error? Also, what's the output of grep 8118 /etc/apt/sources.list /etc/apt/sources.list.d/* – Braiam Nov 2 '13 at 23:39
  • That option might be set in /etc/apt/apt.conf directly (eg, the file, not the include directory). I'd try 'grep 8118 -r /etc/apt/' as a wider search – Daniel Lawson Nov 3 '13 at 1:20
  • That did it. The grep 8118 -r /etc/apt and it returned /etc/apt/apt.conf. There was a proxy value set for http and https. That said I don't believe I set this manually. Certainly not with nano or gedit. Anyways, changing to in that file fixed it. I'm using apt-get upgrade as I write this. Thanks – Gabe Spradlin Nov 3 '13 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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