The command "sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"" failed and exited with 1 during

I test my binary extension (C++) using four different versions of Node (8, 10, 12, 13). Before running a build the script adds a recommended PPA. I assume it should either work or fail regardless of Node version yet it fails in some cases and works in others:

https://travis-ci.org/uhop/node-re2/builds/621845274

I tried to restart failed jobs manually yet they failed again. The last time it happened it was dismissed as some mysterious network problems. I am on the edge of my seat to learn the cause this time.

1 Like

A number of bug reports at Launchpad.net suggest that this is a misleading error message which is also printed on any network, proxy or HTTP(S) error.

1 Like

I have no doubt that it is a flaky I/O — sometimes sudo apt works, sometimes it doesn’t as evidenced in my link. 99.999% is for some network trouble between Travis CI hosts and the standard apt sources. The question is: when is it going to be fixed?

For now I removed the Travis CI build badge so not to upset users.

It looks like the problem was rectified without announcing here. I restarted the failed tasks and this time they completed successfully.

I am faced apt-add-repository’s error “Error: retrieving gpg key timed out” on xenial environment last month. I am not sure it is same error with you.

https://travis-ci.org/ruby/ruby/jobs/623537864#L59

$ tool/travis_retry.sh sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
+ sudo -E apt-add-repository -y ppa:ubuntu-toolchain-r/test
Error: retrieving gpg key timed out.
gpg: keyring `/tmp/tmpya5afzam/secring.gpg' created
gpg: keyring `/tmp/tmpya5afzam/pubring.gpg' created
gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpya5afzam/trustdb.gpg: trustdb created
gpg: key BA9EF27F: public key "Launchpad Toolchain builds" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

Note apt-add-repository command is in software-properties-common deb package.

# dpkg -S /usr/bin/apt-add-repository
software-properties-common: /usr/bin/apt-add-repository

https://packages.ubuntu.com/bionic/software-properties-common

And in my case, here was the issue.
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1713962

software-properties (0.96.24.25) bionic; urgency=medium

  * ppa.py:
   - rework key retrieval, instead of using hkp & gnupg/dirmngr, use https
     & python's built in urllib.
   - thus, add-apt-key for PPAs observes https_proxy for key retrieval
   - simplify gnupg operations, depend on gpg package only, and use
     import/public key operations only.

In my case, just using the software-properties deb package newer version by dist: bionic or sudo apt-get -yq install --only-upgrade software-properties-common might work.

As a reference, in my case, the cause of the issue was by Travis s390x’s IPv6.
I reported it here.