-1

I am using Ubuntu 14.04 and 12.04 with the latest updates behind a proxy server at my school. I had no problem a few months ago. However, over the past two months when I try to add a repository with add-apt-repository there is no key retrieved. I can then use sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEY with success, but this is annoying. I have created scripts that add PPAs, install software, and more that are now failing because of this issue.

Should I be filing a bug report? If so, could someone please direct me to where to file.

Here is what my terminal output looks like when trying to add the PPA for my-weather-indicator:

$ sudo add-apt-repository ppa:atareao/atareao
 Applications from atareao
 More info: https://launchpad.net/~atareao/+archive/ubuntu/atareao
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp16ytp9px/secring.gpg' created
gpg: keyring `/tmp/tmp16ytp9px/pubring.gpg' created
gpg: requesting key 36FD5529 from hkp server keyserver.ubuntu.com
gpgkeys: key A3D8A366869FE2DC5FFD79C36A9653F936FD5529 can't be retrieved
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36FD5529
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.fla11h2USs --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/steam.gpg --keyserver keyserver.ubuntu.com --recv-keys 36FD5529
gpg: requesting key 36FD5529 from hkp server keyserver.ubuntu.com
gpg: key 36FD5529: public key "Launchpad PPA for atareao" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Update: I was able to get it working with the -E parameter for sudo, so the command that works is sudo -E add-apt-repository ppa:atareao/atareao. However, I don't understand why things worked without that before and now it does not. Also, this does not seem to explain why other commands with sudo work without the -E parameter. This solution comes from Ubuntu 10.10.

1
  • That solution works, MadMike, but I don't understand why I did not need the -E a few months ago. Oct 30, 2014 at 16:29

1 Answer 1

3

You are facing two problems:

  1. add-apt-repository is relying on the existence of the correct http_proxy and https_proxy values.

  2. sudo will not use all of the current environment values. Probably for security reasons. There are two possibilities how to overcome this:

    1. Call sudo -E add-apt-repository <additional-options>

      This will use all of the current environment.

    2. You can configure sudo to automatically copy http_proxy and https_proxy too. Do this:

      sudo visudo
      

      Add the following lines:

      Defaults env_keep +="http_proxy"
      Defaults env_keep +="https_proxy"
      

      Blantantly copied from this answer.

3
  • This all makes sense, but then why does sudo apt-get update work fine without any modification? Nov 3, 2014 at 17:51
  • My guess is, that apt-get can fallback to reading /etc/apt/apt.conf or the /etc/apt/apt.conf.d/*-files and add-apt-repository doesn't. Unfortunately, this all just stuff I've looked up while wrestling with corporate proxy configurations. I don't have any first-hand "I've seen the code"-knowledge :-/
    – MadMike
    Nov 3, 2014 at 21:39
  • This makes the most sense from what I've read around the web. Thanks! Nov 4, 2014 at 15:00

Not the answer you're looking for? Browse other questions tagged .