← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1834632] Re: apt-key add fails with raw key input

 

Hi shine,

Thanks for the additional information.  It looks to me like these keys
aren't valid; both of them are missing a leading "-" on their first
line, which causes gpg to not be able to operate on them.  For example,
comparing the Rabbit key to the one provided upstream:

# diff their.gpg our.gpg 
1c1
< -----BEGIN PGP PUBLIC KEY BLOCK-----
---
> ----BEGIN PGP PUBLIC KEY BLOCK-----


If changing that doesn't fix the problem, please feel free to let us know and set this back to New.


Thanks!

Dan

** Changed in: cloud-init
       Status: Incomplete => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1834632

Title:
  apt-key add fails with raw key input

Status in cloud-init:
  Invalid

Bug description:
  Upon adding a raw key within cloud-config in apt > sources > <source>
  > key, the apt-key add operation hits a
  cloudinit.util.ProcessExecutionError.

  Environment Information :
  Operating System : Ubuntu 18.04.2 LTS
  Cloud Init : 19.1-1-gbaa47854-0ubuntu1~18.04.1

  Relevant logs :

  ==> /var/log/cloud-init-output.log <==
  Cloud-init v. 19.1-1-gbaa47854-0ubuntu1~18.04.1 running 'modules:config' at Fri, 28 Jun 2019 11:31:03 +0000. Up 24.14 seconds.
  2019-06-28 11:31:04,390 - 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 551, 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 2069, in subp
      cmd=args)
  cloudinit.util.ProcessExecutionError: Unexpected error while running command.
  Command: ['apt-key', 'add', '-']
  Exit code: 2
  Reason: -
  Stdout: 
  Stderr: Warning: apt-key output should not be parsed (stdout is not a terminal)
          gpg: no valid OpenPGP data found.

  ==> /var/log/cloud-init.log <==
  2019-06-28 11:31:04,390 - 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 551, 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 2069, in subp
      cmd=args)
  cloudinit.util.ProcessExecutionError: Unexpected error while running command.
  Command: ['apt-key', 'add', '-']
  Exit code: 2
  Reason: -
  Stdout: 
  Stderr: Warning: apt-key output should not be parsed (stdout is not a terminal)
          gpg: no valid OpenPGP data found.
  2019-06-28 11:31:04,401 - handlers.py[DEBUG]: finish: modules-config/config-apt-configure: FAIL: running config-apt-configure with frequency once-per-instance

  ==> /var/log/cloud-init-output.log <==
  2019-06-28 11:31:04,401 - util.py[WARNING]: Running module apt-configure (<module 'cloudinit.config.cc_apt_configure' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py'>) failed

  ==> /var/log/cloud-init.log <==
  2019-06-28 11:31:04,401 - util.py[WARNING]: Running module apt-configure (<module 'cloudinit.config.cc_apt_configure' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py'>) failed
  2019-06-28 11:31:04,402 - util.py[DEBUG]: Running module apt-configure (<module 'cloudinit.config.cc_apt_configure' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py'>) failed
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 812, in _run_modules
      freq=freq)
    File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
      return self._runners.run(name, functor, args, freq, clear_on_fail)
    File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
      results = functor(*args)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 283, in handle
      apply_apt(cfg, cloud, target)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 331, in apply_apt
      template_params=params, aa_repo_match=matcher)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 600, in add_apt_sources
      add_apt_key(ent, target)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 571, in add_apt_key
      add_apt_key_raw(ent['key'], target)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 551, 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 2069, in subp
      cmd=args)
  cloudinit.util.ProcessExecutionError: Unexpected error while running command.
  Command: ['apt-key', 'add', '-']
  Exit code: 2
  Reason: -
  Stdout: 
  Stderr: Warning: apt-key output should not be parsed (stdout is not a terminal)
          gpg: no valid OpenPGP data found.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1834632/+subscriptions


References