DieterReuter / image-builder-rpi64

Build SD card image for Raspberry Pi 3 64bit
MIT License
156 stars 38 forks source link

Missing dirmngr package causes adding GPG keys for apt with cloud-init to fail #56

Closed ecliptik closed 6 years ago

ecliptik commented 6 years ago

Using the latest v20180107-184643 image on an RPI3, cloud-init fails to add GPG keys for apt repositories example due to missing the package dirmngr. Error in /var/log/cloud-init-out.log with example user-data.yml,

Command: ['gpg', '--keyserver', 'keyserver.ubuntu.com', '--recv', 'A7317B0F']
Exit code: 2
Reason: -
Stdout: -
Stderr: gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
        gpg: connecting dirmngr at '/root/.gnupg/S.dirmngr' failed: No such file or directory
        gpg: keyserver receive failed: No dirmngr

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/gpg.py", line 54, in getkeybyid
    recv_key(keyid, keyserver=keyserver)
  File "/usr/lib/python3/dist-packages/cloudinit/gpg.py", line 37, in recv_key
    (key, keyserver, error))
ValueError: Failed to import key "A7317B0F" from server "keyserver.ubuntu.com" - error Unexpected error while running command.

After adding dirmngr manually, gpg commands works properly. The image also seems to be missing the less package.

The previous release v20171221-092341 works properly using the same user-data.yml and includes the dirmngr package.

Looking over commit history, it seems that the image was updated to user a newer version of os-rootfs. The tarballs of v1.2.4 and v1.2.5 both do not include the dirmngr or less commands. I will open an issue in this repository as well.

DieterReuter commented 6 years ago

Thanks for your input. As these packages are dependencies on cloud-init I think it's better to install them together. So PR #57 resolves this issue.