apt-get update
报错
复制代码
1
2
3
4
5
6
7
8
9
10
11root@2870e7cf8e74:/usr/tools# apt-get update Ign:1 https://mirrors.aliyun.com/ubuntu trusty InRelease Get:2 https://mirrors.aliyun.com/ubuntu trusty Release [58.5 kB] Get:3 https://mirrors.aliyun.com/ubuntu trusty Release.gpg [933 B] Ign:3 https://mirrors.aliyun.com/ubuntu trusty Release.gpg Reading package lists... Done W: GPG error: https://mirrors.aliyun.com/ubuntu trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32 E: The repository 'https://mirrors.aliyun.com/ubuntu trusty Release' 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.
解决办法:
将不可用的pubkey加到ubuntu服务器,从上面可以看到如下pubkey
复制代码
1
2NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
使用以上pubkey拼接如下命令
复制代码
1
2
3
4
5
6gpg --keyserver keyserver.ubuntu.com --recv 40976EAF437D05B5 gpg --export --armor 40976EAF437D05B5 | apt-key add - gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32 gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -
我的环境因为是docker中的Python环境 ,默认用户是root,所以不用加sudo,如果非root用户可能会需要切换用户获取权限。则命令如下:
复制代码
1
2
3
4
5sudo gpg --keyserver keyserver.ubuntu.com --recv 40976EAF437D05B5 sudo gpg --export --armor 40976EAF437D05B5 | sudo apt-key add - sudo gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32 sudo gpg --export --armor 3B4FE6ACC0B21F32 | sudo apt-key add -
执行完以上命令后可以正常执行apt-update
命令
复制代码
1
2
3
4
5
6
7
8
9
10
11root@2870e7cf8e74:/usr/tools# apt-get update Ign:1 https://mirrors.aliyun.com/ubuntu trusty InRelease Get:2 https://mirrors.aliyun.com/ubuntu trusty Release [58.5 kB] Get:3 https://mirrors.aliyun.com/ubuntu trusty Release.gpg [933 B] Get:4 https://mirrors.aliyun.com/ubuntu trusty/main amd64 Packages [1350 kB] Get:5 https://mirrors.aliyun.com/ubuntu trusty/multiverse amd64 Packages [132 kB] Get:6 https://mirrors.aliyun.com/ubuntu trusty/restricted amd64 Packages [13.0 kB] Get:7 https://mirrors.aliyun.com/ubuntu trusty/universe amd64 Packages [5859 kB] Fetched 7414 kB in 22s (343 kB/s) Reading package lists... Done
最后
以上就是忧心毛巾最近收集整理的关于apt-get update出现NO_PUBKEY问题解决的全部内容,更多相关apt-get内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复