1

I cannot add-apt-repository because the Ubuntu keyserver times out:

$ sudo add-apt-repository ppa:git-core/ppa -y
gpg: keyring `/tmp/tmpxzw15cei/secring.gpg' created
gpg: keyring `/tmp/tmpxzw15cei/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

$ uname -a
Linux gkistner-dt3 4.2.0-36-generic #41~14.04.1-Ubuntu SMP Tue Apr 19 17:03:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty

I'm running Xubuntu. Per this post I have checked and found that Xubuntu has no firewall. Per comments on this post I am not behind a corporate proxy (though I am on a corporate LAN that NATs all global traffic); I am able to directly telnet keyserver.ubuntu.com 80.

If I try to hack in this answer I get a similar result:

$ sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E1DF1F24
gpg: directory `/home/gkistner/.gnupg' created
gpg: new configuration file `/home/gkistner/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/gkistner/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/gkistner/.gnupg/secring.gpg' created
gpg: keyring `/home/gkistner/.gnupg/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

How do I add this repository?

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
Phrogz
  • 1,646
  • Are you running in a VM? –  May 16 '16 at 18:44
  • @bc2946088 I am not running in a VM. – Phrogz May 16 '16 at 18:44
  • What version of Kubuntu are you on, have you tried a different key server? –  May 16 '16 at 18:46
  • Nevermind, just read 14.04 -- try to use hkp://keys.gnupg.net –  May 16 '16 at 18:47
  • @bc2946088 Attempting sudo gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys E1DF1F24 eventually appears to succeed, but I cannot then re-run the initial add-apt-repository command successfully. (It still tries to request the key.) – Phrogz May 16 '16 at 18:53
  • You'll need to use apt-key adv to add it –  May 16 '16 at 20:26
  • @bc2946088 And then what? I just sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E1DF1F24 (which worked) but then when I run the original command it still fails in the same way. – Phrogz May 16 '16 at 20:56
  • In my case was a proxy issue, solved setting the environment variables and sudo -E. – Pablo Bianchi May 09 '18 at 06:43

2 Answers2

0

Use this command :

$ sudo add-apt-repository ppa:git-core/ppa -y

If it works then cheers :D. If it don't worked then use :

$ sudo add-apt-repository ppa:git-core/ppa -y

and close your terminal window instantly.Now open terminal again and use the command :

$ sudo add-apt-repository ppa:git-core/ppa

now,that's it.

Parsa Mousavi
  • 3,305
  • 16
  • 37
0

A coworker discovered that there is some sort of weird networking going on at our site. Running the original command multiple times in a row sudo add-apt-repository ppa:git-core/ppa -y repeatedly timed out (after 60s+ of delay each time) and then, magically, it succeeded. Same command, no change to any settings.

Phrogz
  • 1,646