29

When I run this command:

sudo add-apt-repository ppa:webupd8team/sublime-text-3

I get the following error:

Cannot add PPA: 'ppa:~webupd8team/ubuntu/sublime-text-3'.
ERROR: '~webupd8team' user or team does not exist

My proxy settings are working properly

what's the solution?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
Devil
  • 391
  • 1
  • 3
  • 4
  • 2
    APT seems to not work behind certain proxy types/configurations. –  Nov 01 '17 at 23:25
  • Did you configure apt - https://askubuntu.com/questions/257290/configure-proxy-for-apt ? If so try to manually add the repo deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu YOUR_UBUNTU_VERSION_HERE main – Panther Nov 01 '17 at 23:26
  • 1
    I think it's more simply that wepupd8team hasn't updated the ppa for bionic, the last update is almost 40 weeks old. Edit: https://launchpad.net/~webupd8team/+archive/ubuntu/sublime-text-3 Open that link and click on "tecnical details about this ppa", you'll see it doesn't have a bionic(18.04) version – dsSTORM May 15 '18 at 17:33
  • @David Foerster I don't actually know if OP is using 18.04, though, if he confirms it I'll surely post my comment as an answer. – dsSTORM May 15 '18 at 17:44
  • 1
    @dsSTORM: I just saw that this question is from November and that the PPA in question had packages for all supported Ubuntu releases at the time. Nevermind then. – David Foerster May 15 '18 at 19:01
  • I just removed the unsuccessful entries from the software and updates and then retried the command and it worked. – Ahmad Kakarr Jul 25 '19 at 06:41
  • For me it was the corporate proxy that I was connected to that was triggering that error. After I disconnected from that corporate proxy my "sudo apt" commands worked. – luisdev Apr 14 '21 at 11:22

5 Answers5

34

I found a working solution at add-apt-repository derrière un proxy d'entreprise (in French).

To summarize it, you have to export the env variables HTTP(S)_PROXY, lowercase and uppercase in your term.

Then execute:

sudo -E add-apt-repository ppa:...

The -E option will preserve the env vars defined above, and will enable the proxy use.

Eliah Kagan
  • 117,780
Guillaume Husta
  • 561
  • 1
  • 5
  • 10
  • 1
    Unfortunately this didn't work for me in ubuntu 18.04 when trying to install Oracle 8 JDK. I fixed it by putting deb http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main in the Software Updater's settings (Settings > Other Software > Add...) – snark Sep 07 '18 at 10:50
  • 2
    This worked under Windows Subsystem for Linux ( Ubuntu 19.x ) for me. –  Sep 13 '19 at 17:45
6

In my case it was my company's man-in-the-middle fake SSL certificate that caused this misleading error. If you are on corporate internet, you may need to install your company's SSL cert at /usr/local/share/ca-certificates/yourcompany.crt and run sudo apt-get update && sudo apt-get install ca-certificates -y && sudo update-ca-certificates

PolyTekPatrick
  • 278
  • 3
  • 6
  • 1
    "sudo apt-get update && sudo apt-get install ca-certificates -y && sudo update-ca-certificates" worked for me, thanks for the hint! – Pavel K Aug 28 '22 at 20:50
4

Running add-apt-repository without internet connection really does produce the same error message as in the question. One might consider the error message being incorrect or confusing like this as a bug though.

Adding the corresponding repositories is not enough unless you have an internet connection.

I fixed this by making an internet connection because the repositories had already been added.

Check this with: $ ping www.google.com

Braian Coronel
  • 385
  • 3
  • 6
  • 3
    Running add-apt-repository without internet connection really does produce the same error message as in the question, so this answer is 100% valid. One might consider the error message being incorrect or confusing like this as a bug though. – Byte Commander Dec 08 '19 at 15:18
  • 1
    @ByteCommander Thank you very much for understanding and moderating this answer. I added your comment to the body of the response. Regards – Braian Coronel Dec 09 '19 at 01:09
3

Also, consider your VPN activity when using WSL as in general VPN's and WSL (Ubuntu) don't mix well. So if you are receiving these errors with a VPN connected, try disabling your VPN and running the command again. This is an odd fix that should be attempted if the above mentioned solutions aren't working for you.

More info here: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting under the Bash loses network connectivity once connected to a VPN

tdiorio
  • 31
0

It seems add-apt-repository doesn't use apt proxy settings (maybe it's using wget under the hood). A workaround is to tun the command from a machine which is not behind a proxy and to copy the files

/etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg
/etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list

to the other machine.

dev93
  • 183