Ubuntu的软件源更新常见问题及如何解决

最近家里的网可能被天朝了,一直很好用的更新设置,出现各种错误,但在公司可以,所以应该是网络的问题,所以把遇到的问题整理了一下: 问题一: 执行命令 sudo

最近家里的网可能被天朝了,一直很好用的更新设置,出现各种错误,但在公司可以,所以应该是网络的问题,所以把遇到的问题整理了一下:

问题一:

执行命令

sudo apt-get update

错误描述如下:

W: Failed to fetch http://mirrors.sohu.com/ubuntu/dists/precise/universe/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/mirrors.sohu.com_ubuntu_dists_precise_universe_i18n_Index

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/mirrors.sohu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法:

将/var/lib/apt/lists/partial/下的所有文件删除,但是这可以解决大部分问题,个别源不能解决,如"/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages",无耐进入/var/lib/apt/lists/将对应的文件删除

注:经过长时间的实践,这个解决方法不是万能的,最终解决方法还是FQ吧。 

 

问题二:

无法找到对应的KEY

W: GPG error: http://mirrors.sohu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://mirrors.sohu.com precise-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://mirrors.sohu.com precise-proposed Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://archive.canonical.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://security.ubuntu.com precise-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5

解决方法:

使用如下命令:

gpg --keyserver subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg -a --export 40976EAF437D05B5 | sudo apt-key add -

 

 

参考网站:

http://wiki.debian.org/SecureApt

以下您可能有感兴趣的文章: