Ubuntu

apt-get update 失敗:以下簽名無效

  • April 5, 2019

最近,當我嘗試檢查筆記型電腦(Ubuntu 12.04)上的更新時,檢查失敗。

sudo apt-get update:

W: GPG error: http://us.archive.ubuntu.com precise Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Index
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise_multiverse_i18n_Index
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise_restricted_i18n_Index
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Index
E: Some index files failed to download. They have been ignored, or old ones used instead.

/etc/apt/sources.list(已刪除評論):

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted

deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse

deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
deb http://archive.canonical.com/ precise partner
deb-src http://archive.canonical.com/ precise partner

我不確定如何解決問題並感謝任何輸入。

經過一番搜尋,我找到了解決方案

刪除/重命名與錯誤相關的文件:

cd /var/lib/apt/lists/partial/
sudo mv us.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Index main_COPY
sudo mv us.archive.ubuntu.com_ubuntu_dists_precise_multiverse_i18n_Index multi_COPY
sudo mv us.archive.ubuntu.com_ubuntu_dists_precise_restricted_i18n_Index res_COPY
sudo mv us.archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Index uni_COPY

更新簽名:

gpg --keyserver keyserver.ubuntu.com --recv 40976EAF437D05B5

重建軟體記憶體:

cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get update

可以通過簡單地移動列表來跳過第一步,但我認為最好描述我用來刪除錯誤的整個過程。

引用自:https://unix.stackexchange.com/questions/82707