How do I fix the GPG error “NO_PUBKEY”?

来源:互联网 发布:python 书籍 知乎 2016 编辑:程序博客网 时间:2024/06/11 05:51

##### Error

When it's to run 'sudo apt-get update" command, there will be some failures like this:


W:There is no public key available for the following key IDs: 3B4FE6ACC0B21F32

W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BAF9A6F


##### Solution:
Execute the following commands in terminal

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PUBKEY>

where <PUBKEY> is your missing public key for repository, e.g. 8BAF9A6F.

Then update

sudo apt-get update

----------------------------------

ALTERNATE METHOD:


sudo gpg --keyserver pgpkeys.mit.edu --recv-key  <PUBKEY>
sudo gpg -a --export <PUBKEY> | sudo apt-key add -

sudo apt-get update


%%%%%%%%%%%%%%%%%%%

ubuntu更新(sudo apt-get update)时,
出现错误:
“Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry ‘main/binary-i386/Packages’ in Release file (Wrong sources.list entry or malformed file)”

解决方式:
1,打开 /etc/apt/sources.list.d/google-chrome.list 文件(用vim或者gedit等均可):
sudo vim /etc/apt/sources.list.d/google-chrome.list

2,修改文件内容:
原来是:
deb http://dl.google.com/linux/chrome/deb/ stable main
改为:
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

3,再次执行 更新命令即可通过了
sudo apt-get update



%%%%%%%%%%%%%%%

在运行sudo apt-get update的时候遇到以下错误:

[plain] view plain copy
  1. W: Failed to fetch bzip2:/var/lib/apt/lists/partial/mirrors.163.com_ubuntu_dists_quantal-updates_main_binary-i386_Packages  Hash Sum mismatch  
  2.   
  3. E: Some index files failed to download. They have been ignored, or old ones used instead.  

这里有一堆关于这个Error的帖子: Ubuntu Forums

关于这个问题的原因,答案挺多,不过总的来说就是提供源的服务器的问题。可能是因为网络问题导致tcp包没有发送完整,也有可能是因为服务器那边繁忙所以没有处理你的请求,也有可能是因为服务器那边进行了缓存导致软件列表不是最新的,等等。。。(如果哪里说错说漏了,欢迎批评指正补充~)


网上的解决方法挺多的:

(1)我是用这个方法解决的,from here

[python] view plain copy
  1. sudo apt-get clean  
  2. sudo apt-get update --fix-missing  


(2)删掉/var/lib/apt/lists 这个目录下的东西,fromhere

[python] view plain copy
  1. # 删除  
  2. sudo rm -fR /var/lib/apt/lists/*  
  3. # 新建相应文件夹  
  4. sudo mkdir /var/lib/apt/lists/partial  
  5. # 重新update  
  6. sudo apt-get update  


(3)换源。

好像是从ubuntu11.04开始,换源都可以在system settings里面直接操作了,不用命令行那么麻烦了。。。

ps:在天朝的话,如果是校园网的,就找个edu.cn的源;如果不是校园网的话,我个人用着163的mirror觉得还不错。


0 0
原创粉丝点击