APT解决验签问题
May 2018
25
Fix key errors
前言
当你使用第三方的ppa或者自建软件仓库时,经常会遇到各种验签问题。如:
W:GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key
这是因为本地没有相对应的公钥或者仓库不规范导致的。如果你非要使用这个软件源,哪怕它是不安全的,请阅读并采用下面两种方法之一:
导入仓库公钥
一般公网上的仓库都有自己的keyserver,下面以ubuntu为例:
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
这时候就可以看到这个公钥了
$ sudo apt-key finger
/etc/apt/trusted.gpg
pub 1024D/3E5C1192 2010-09-20
Key fingerprint = C474 15DF F48C 0964 5B78 6094 1612 6D3A 3E5C 1192
uid Ubuntu Extras Archive Automatic Signing Key
当然你也可以手动拷贝导入,一般这时候就可以update了
如果还有问题,可以尝试:
$ sudo apt-key del 16126D3A3E5C1192
$ sudo apt-get clean # Remove cached packages
$ sudo mv /var/lib/apt/lists /tmp/ # Move existing mirror info
$ sudo mkdir -p /var/lib/apt/lists/partial # Recreate directory structure
$ sudo apt-get clean
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
$ sudo apt-get update
修改APT配置
警告:这个方案非常危险,请在实在没办法并且知道后果的前提下尝试:
在/etc/apt/apt.conf.d/中新建一个文件,添加以下内容:
APT::Get::AllowUnauthenticated "1";
Acquire::AllowInsecureRepositories "1";
这样就跳过验签了
--转载请注明: https://momo.cool/apt%e8%a7%a3%e5%86%b3%e9%aa%8c%e7%ad%be%e9%97%ae%e9%a2%98/
说点什么