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
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.

  • 1
    Its your internet connection. Your system can't resolve launchpad.net while you're on that proxy.
    – Thomas Ward
    Jun 27, 2012 at 14:57
  • I just needed to reboot because something happened to my internet connection. Then everything was fine again.
    – demongolem
    Oct 23, 2015 at 19:51

9 Answers 9


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?

  • 1
    That -E saved me a lot of time, everything else was setup properly. thanks Jan 23, 2014 at 10:13

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=
  • 1
    This helped, thanks! In my case: export https_proxy=$(echo $http_proxy | sed 's/http:/https:/')
    – akavel
    Nov 30, 2012 at 16:13

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

sudo vi /etc/resolv.conf

And add


This might help.

  • By some motive my dns was working at the browser but no in terminal
    – deFreitas
    Oct 29, 2016 at 17:46

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

  • 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 ?
    – user60660
    May 5, 2012 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 5, 2012 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 ppa.launchpad.net/<user>/<repo>/ubuntu precise main for a PPA based on : ppa:<user>/<repo> 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.
    – user60660
    May 5, 2012 at 13:04

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?


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.


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

You could also try setup HTTPS_PROXY, if needed.


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.


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.


hosts:          wins files dns


hosts:          files dns wins

Saved and rebooted. Life was good again.

You must log in to answer this question.