19

For example, after running this command:

sudo add-apt-repository ppa:tualatrix/ppa

I get the following output :

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 125, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 80, in get_ppa_info_from_lp
    curl.perform()
pycurl.error: (6, "Couldn't resolve host 'launchpad.net'")

Why does this happen? I just installed Ubuntu 12.04 LTS. And it works fine. I have updated and installed the system. I have even installed all required packages. But the thing is as soon as I want to install more packages, like PPA's and that sort of thing, I am not able to do so.

Until now I have not been able to install any PPA.

I am working behind a proxy.

Braiam
  • 67,791
  • 32
  • 179
  • 269

9 Answers9

7

As others have said, you need to set HTTP_PROXY and HTTPS_PROXY but you also need to use the option '-E' to tell sudo to use the environment variables you've just set!

sudo -E add-apt-repository ppa:tualatrix/ppa

ref: How do I get add-apt-repository to work through a proxy?

dm76
  • 171
  • 1
  • 2
6

Ah ... I've been caught out with this before! I've been trying to add the webupd8team PPA to my newly installed 12.04

I already had:

export http_proxy=

but webupd8team (and I think launchpad) need:

export https_proxy=
Eliah Kagan
  • 117,780
  • 1
    This helped, thanks! In my case: export https_proxy=$(echo $http_proxy | sed 's/http:/https:/') – akavel Nov 30 '12 at 16:13
3

I came across this issue as well. Check your /etc/resolv.conf settings using;

sudo vi /etc/resolv.conf

And add

nameserver IP.ADDRESS.OF.YOUR.DNS.SERVER
nameserver IP.ADDRESS.OF.YOUR.PROXY.SERVER

This might help.

2

It seems more like of the proxy problem. The server you are trying to connect to is not getting past through your connection because the proxy connection is refusing it. To get it right, Just close your proxy and they try re-running your program. Maybe that can help

ashutosh
  • 1,292
  • well i have no other connections other than the proxy.. i am in a college. our connection is proxy based. the most troubling fact is that i am able to install most applications via sudo apt-get install like normal. but PPA installations are not working. you really think the proxy is a concern ? –  May 05 '12 at 10:53
  • as the error reflects, it reports threw a python url error. All seems to be correctly configured except that python now has not got correctly over proxy. so why don't just write a simple python program to test if it is working with the current url settings? go here or else you can set proxy for the terminal like explained here – ashutosh May 05 '12 at 11:18
  • i have my proxy settings put carefully in network proxy. So as such my "env | grep proxy" gives the correct proxy settings. the terminal is able to use the proxy.other wise apt-get would show connection errors.i added the ppa in the source list of ubuntu software center in the form of:

    deb http://ppa.launchpad.net///ubuntu precise main

    for a PPA based on : ppa:/

    This worked after doing apt-get update.the PPA was added.

    i was able to install the software that was found in the PPA.

    something is wrong with python-software-properties. proxy is fine.

    –  May 05 '12 at 13:04
2

The mentioned error indicates a fault DNS configuration. I find it weird that you can download other packages and visit Ask Ubuntu, but not Launchpad. Try setting an alternative DNS server as described in What is the proper way to change the DNS IP?

Lekensteyn
  • 174,277
1

Here are the commands:

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

You'll have to edit the italicized lines to provide information specific to your system.

Eliah Kagan
  • 117,780
Debmalya
  • 11
  • 1
0

I think this happens because the proxy information is not set to root user. In my system i get those results:

echo $HTTP_PROXY --> http://my.proxy.address
sudo echo $HTTP_PROXY --> (prints nothing)

So a quick workaround will be:

sudo -i
export HTTP_PROXY="http://username:password@proxy_address:port"
add-apt-repository ppa:tualatrix/ppa
exit

You could also try setup HTTPS_PROXY, if needed.

Salem
  • 19,744
0

I am also facing the same problem. Try this,, It solves the problem. Go to System Settings -> Network -> Network Proxy : Select Method: Manual and assign proxy and port then try.

Its Me
  • 11
  • 5
0

I had this exact same problem on a 12.04 LTS VM, but I was NOT using a proxy, however I was using a WINS server. The problem turned out to be that I had misconfigured the hosts line of the nsswitch.conf by placing the wins entry before the dns entry.

Problem:

hosts:          wins files dns

Fix:

hosts:          files dns wins

Saved and rebooted. Life was good again.

James
  • 1