I'm trying to update my apt-get list. In my country a lot of sites are blocked or have been blocked from companies.

When I use a proxy for the whole system I get errors, Tor works perfectly when browsing. Can I update apt-get through a connection from Tor? I mean I want to unblock the blocked sites using Tor connection, so I can perform apt-get update without errors.

Edit: I'm using Ubuntu 13.10 and Tor 0.2.21

$ sudo apt-get update
[sudo] password for alexander: 
Ign http://extras.ubuntu.com saucy InRelease                                   
Ign http://security.ubuntu.com saucy-security InRelease                        
Ign http://us.archive.ubuntu.com saucy InRelease                               
Hit http://extras.ubuntu.com saucy Release.gpg                                 
Get:1 http://dl.google.com stable InRelease [1,540 B]
100% [1 InRelease gpgv 1,540 B] [Waiting for headers] [Waiting for headers]        
[WaSplitting up/var/lib/apt/lists/partial/dl.google.com_linux_chrome_deb_dists_stabIgn  
http://dl.google.com stable InRelease                                      
E: GPG error: http://dl.google.com stable InRelease: Clearsigned file isn't valid, 
got 'NODATA' (does the network require authentication?
  • What is the output of sudo apt-get update?
    – Braiam
    Nov 23 '13 at 23:07
  • Can you run it again but now sudo apt-get update -o Debug::Acquire::http=true?
    – Braiam
    Nov 23 '13 at 23:20
  • 2
    For all I know, there's problems accessint google servers trough tor, google detects all the connections coming from the same address and blocks it. You could try to remove google from your sources list and see if you get errors with other repositories or is just that one. Nov 23 '13 at 23:21
  • E: Option Debug::Acquire::http: Configuration item specification must have an =<val>.
    – Alexander
    Nov 23 '13 at 23:21
  • @Alexander - please update your question with any responses - try not to add vital info in comments because they are often difficult to read. Thanks.
    – fossfreedom
    Nov 23 '13 at 23:26

Install the apt-transport-tor package and then:

Edit /etc/apt/sources.list to add the prefix tor+ to your repositories.

deb     tor+http://deb.debian.org/debian unstable main
deb-src tor+http://deb.debian.org/debian unstable main

This will allow apt to run over tor.

Note: Substitute http://deb.debian.org/debian unstable main with the appropriate sources for your distribution.

  • It worked for me. Tnx
    – ako
    Sep 3 '19 at 10:14

You can use torsocks, It's shell wrapper to torify applications, to simplify the use of the Tor socks.

torsocks apt-get update

You must remove http://dl.google.com from apt source the first way is remove from software center or edit /etc/apt/sources.list with root access,Read it.

and if you use the kubuntu you can use software center and choose source tap click on configure source software and choose other tab remove http://dl.google.com.

and after than :

sudo apt-get clean
sudo apt-get update
  • 2
    This would stop Chrome from being updated while the question is there to find a way to update it May 10 '16 at 18:15
  • @MostafaAhangarha The chrome is not official Ubuntu repo, The chromium is official but there is not direct and prefect way to upgrade automate google chrome.
    – A1Gard
    May 11 '16 at 4:21
  • Then you are saying he should use chromium instead of Chrome which is not relevant to the question. Yet, I do not see this suggestion anywhere in your answer. You just simply remove Chrome from being updated which is not the answer for his question. He wants to update Google Chrome and because of the problems he explained, he cannot do it through a network without proxy (same problem I have). I suggested him to use torify to be able to pass his traffic through Tor network which can solve his problem as it did in my case as well. May 11 '16 at 5:41
  • Google Chrome can be updated directly and perfectly like any other software you install on your Ubuntu. Just in few countries including Iran, Google company doesn't allow using some of its services including accessing the update for Chrome. As the solution, one need to use proxy. Best of luck May 11 '16 at 5:47

If you have installed Tor from terminal, you must have torify. If so, simply you can pass the traffic of any script or program from tor.

First become root using sudo su then run this:

torify apt-get update

Then you can update your Google Chrome in the regular way using

apt-get upgrade

I am in Iran so facing with same problem of yours. I just used this method to update my Chrome.

  • It's not work for me...
    – A1Gard
    May 22 '16 at 22:07
  • What about sudo torify apt-get update ? If not, what is the error? May 23 '16 at 4:41
  • Yes of curse ...
    – A1Gard
    May 24 '16 at 7:15
  • You mean it still doesn't work? If not, is the Tor-browser working and connected before you run the command? It works perfectly for me. May 24 '16 at 8:25
  • 1
    torify is now just a wrapper around torsocks for backwards compatibility Oct 21 '19 at 16:16

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.