Can't apt update due to key NO_PUBKEY error on ubuntu 18.04

Viewed 95

I'm working on a Linux Ubuntu-18.04 Os. When I do sudo apt-get update, I'm getting the following error:

Reading package lists... Done
W: GPG error: file:/var/cudnn-local-repo-ubuntu1804-8.5.0.96
InRelease: The following signatures couldn't be verified because the public key is not
available: NO_PUBKEY 8EC7C4A37DA6B9A9
E: The repository 'file:/var/cudnn-local-repo-ubuntu1804-8.5.0.96  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt secure(8) manpage for repository creation and user configuration details. 

tried

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8EC7C4A37DA6B9A9
sudo apt-key adv --keyserver keyserver.ubuntu.com:80 --recv-keys 8EC7C4A37DA6B9A9
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 8EC7C4A37DA6B9A9
sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 8EC7C4A37DA6B9A9
gpg --keyserver pgp.mit.edu --recv-keys 8EC7C4A37DA6B9A9
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb

and running sudo apt-get update afterward still gives me the NO_PUBKEY error. How do I get this fixed properly? My sources are the following:

cat /etc/apt/sources.list.d/seafile.list
deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/focal/ stable main
1 Answers

The error message "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8EC7C4A37DA6B9A9".
Have you tried
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8EC7C4A37DA6B9A9
If still not working, then search "how to update the CUDA ubuntu GPG Repository Key" or "fix missing gpg key for repos". This is very common in Ubuntu. Sometimes it's just the author forgets to update the key.

Related