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:

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

$ tool/ 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
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)

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

And in my case, here was the issue.

software-properties ( bionic; urgency=medium

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