Comment 2 for bug 1618572

Revision history for this message
Scott Moser (smoser) wrote : Re: cloud-init failing to configure sources and additional repository

Aug 30 17:42:59 node03 [CLOUDINIT] cc_apt_configure.py[ERROR]: failed to add apt GPG Key to apt keyring
Traceback (most recent call last):
 File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 333, in add_apt_key_raw
 util.subp(['apt-key', 'add', '-'], data=key.encode(), target=target)
 File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1832, in subp cmd=args)
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['apt-key', 'add', '-']
Exit code: 1
Reason: -
Stdout: ''
Stderr: 'Warning: apt-key output should not be parsed (stdout is not a terminal)gpg: renaming `/etc/apt/trusted.gpg.tmp' to `/etc/apt/trusted.gpg' failed: Stale file handle
gpg: error writing keyring `/etc/apt/trusted.gpg': file rename error
gpg: can't open `/etc/apt/trusted.gpg'
gpg: keydb_search failed: file open error
gpg: key 93EE8CC5: public key "[User ID not found]" imported
gpg: error reading `[stdin]': file rename error
gpg: import from `[stdin]' failed: file rename error
gpg: Total number processed: 0
gpg: imported: 1 (RSA: 1)
'
Aug 30 17:42:59 node03 [CLOUDINIT] handlers.py[DEBUG]: finish: modules-config/config-apt-configure: FAIL: running config

Some googlign for the apt-key rename error hits
  https://forums.plex.tv/discussion/218956/ubuntu-16-04-lts-plex-install
  https://bugs.gnupg.org/gnupg/issue1249
Another race condition in gpg:
  https://bugs.gnupg.org/gnupg/issue1675

Although there really shouldn't be any concurrent gpg usage going on.