How to fix add-apt-repository doesn’t work behind a proxy server

I am trying to add ubuntu ppa using add-apt-repository and i was not able to add because of some python error

urllib2.URLError:
The following solution worked for me

Solution 1

$sudo visudo

then add the following lines

Defaults env_keep = "http_proxy https_proxy ftp_proxy"

Save and exit the file

Now try to run the following commands

$ sudo bash
# export https_proxy=http://[username:password@]proxyserver:portnumber/
# add-apt-repository ppa:

It sounds like the real source of confusion surrounding this issue is that the default /etc/sudoers configuration does not pass through http_proxy, https_proxy, ftp_proxy, all_proxy, etc

Solution 2

Use sudo -E instead of sudo before your PPA commands thanks to dr_gogeta86

Please let us know if you have any other work arounds for this problem.

Sponsored Link

You may also like...

5 Responses

  1. See bug 556293 (please report “this bug affects me”):

    https://bugs.launchpad.net/ubuntu/+source/apt/+bug/556293

  2. admin says:

    Just done that

  3. dr_gogeta86 says:

    just do sudo -E and it works

  4. Matias Lopez Riglos says:

    sudoers file must be edited with visudo

    $ sudo visudo

  5. Nando says:

    Thank you very much. This post help me to solve this eternal problem.

    Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *