Sunday, December 15, 2019

apt update public key issue

When running "apt update" in raspberry pi, facing below warning message

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
Following the solution from
refer  https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey , which worked for me.  Cheers.

sudo apt-get install debian-keyring

- below command took  more than 1 minutes

pi@raspberrypi:~ $ sudo gpg --keyserver pgp.mit.edu --recv-keys 0CC3FD642696BFC8
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 8D9940AE59B46979: public key "https://packagecloud.io/headmelted/code-oss (https://packagecloud.io/docs#gpg_signing) " imported
gpg: Total number processed: 1
gpg:               imported: 1


pi@raspberrypi:~ $ sudo gpg --armor --export 0CC3FD642696BFC8 | apt-key add -
E: This command can only be used by root.

pi@raspberrypi:~ $ sudo su -
root@raspberrypi:~# id
uid=0(root) gid=0(root) groups=0(root)
root@raspberrypi:~# gpg --armor --export 0CC3FD642696BFC8 | apt-key add -
OK

Verified running "apt update" without any warning message now.