最近家里的網可能被天朝了,一直很好用的更新設置,出現各種錯誤,但在公司可以,所以應該是網絡的問題,所以把遇到的問題整理了一下:
問題一:
執行命令
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/將對應的文件刪除
注:經過長時間的實踐,這個解決方法不是萬能的,最終解決方法還是翻牆吧。
問題二:
無法找到對應的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 -
參考網站:
