Debian / Ubuntu Linux 遇到大量的 GPG error (BADSIG) 要怎麼解決呢?
錯誤訊息如下述:
問題1
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://dl.google.com stable Release: 以下簽名無效: BADSIG A040830F7FAC5991 Google, Inc. Linux Package Signing Key \<linux-packages-keymaster@google.com\>
W: 無法取得 http://dl.google.com/linux/mod-pagespeed/deb/dists/stable/Release,
W: Some index files failed to download. They have been ignored, or old ones used instead.
問題2
W: GPG error: http://dl.google.com stable Release: The following signatures were invalid: BADSIG A040830F7FAC5991 Google, Inc. Linux Package Signing Key \<linux-packages-keymaster@google.com\>
W: GPG error: http://security.ubuntu.com precise-security Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key \<ftpmaster@ubuntu.com\>
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key \<ftpmaster@ubuntu.com\>
W: GPG error: http://ppa.launchpad.net precise Release: The following signatures were invalid: BADSIG 531EE72F4C9D234C Launchpad webupd8
W: GPG error: http://in.archive.ubuntu.com precise Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key \<ftpmaster@ubuntu.com\>
W: GPG error: http://in.archive.ubuntu.com precise-updates Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key \<ftpmaster@ubuntu.com\>
Linux 修正大量 GPG error BADSIG 的問題
問題1 解法 (單一KEY)
問題1 只是 Key 沒有載入或者剛好此 SIGN 損壞之類的,可以用下述語法修正。
- 語法:sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $KEY
- 範例:sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A040830F7FAC5991
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.zrbyZotROz --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --recv-keys --keyserver keyserver.ubuntu.com A040830F7FAC5991 gpg: 正在請求金鑰 7FAC5991 自 hkp 伺服器 keyserver.ubuntu.com gpg: 金鑰 7FAC5991: "Google, Inc. Linux Package Signing Key \<linux-packages-keymaster@google.com\>" 28 份新的簽章 gpg: 處理總量: 1 gpg: 新的簽章: 28
- 註:多個 KEY 需要執行,可以用此 script:($KEY1, $KEY2, $KEY3 請自行更換成 KEY值)
for key in $KEY1 $KEY2 $KEY3; do sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $key; done
問題2 解法 (多KEY修正)
問題2 是 KEY 大量損壞的問題,可以用下述幾種解法試試看:
解法1
- sudo apt-key update
解法2
- sudo apt-get clean
- cd /var/lib/apt
- sudo mv lists lists.old
- sudo mkdir -p lists/partial
- sudo apt-get clean
- sudo apt-get update
- 沒問題後,sudo rm -fr lists.old