apt-get update报告GPG error的解法 - shliph - 博客园 (cnblogs.com)
报告GPG error的原因,大部分是因为本地缺少相应的Public key,只需按照错误提示,把public key添加到本地信任列表即可。下面以访问nvidia repo的异常举例说明。
root@~:/etc/apt/sources.list.d# apt-get update
......
Hit:5 <https://packages.cloud.google.com/apt> kubernetes-xenial InRelease
Ign:6 <http://download.bareos.org/bareos/release/17.2/xUbuntu_16.04> InRelease
Hit:7 <http://download.bareos.org/bareos/release/17.2/xUbuntu_16.04> Release
Hit:9 <https://download.docker.com/linux/ubuntu> xenial InRelease
Ign:10 <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> InRelease
Get:11 <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Release [169 B]
Get:12 <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Release.gpg [169 B]
Ign:12 <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Release.gpg
Hit:13 <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Packages
Fetched 1,397 B in 16s (86 B/s)
Reading package lists... Done
W: GPG error: <https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F60F4B3D7FA2AF80
W: The repository '<https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64> Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
apt-get install -y apt-transport-https
例如将/etc/apt/sources.list.d/nvidia-ml.list中的
deb [<http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64>](<http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64>) /
更换为:
deb [<https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64>](<https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64>) /
查看 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 页面并找到 .pub 文件,然后用.pub更新apt-key,例如下面的命令:
wget -qO - [<https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/7fa2af80.pub>](<https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/7fa2af80.pub>) | sudo apt-key add -
lsb_release -a
lscpu
export distro=ubuntu2004
export arch=x86_64
wget <https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb>
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get install cuda
sudo apt-get install cuda-gds
sudo reboot
export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}