Apt update : failed to fetch expkeysig abf5bd827bd9bf62 nginx signing key signing-key@nginx.com

apt update ,更新 nginx 时报错。 提示 Nginx 签名无效, 无法获取.

failed to fetch https://nginx.org/packages/mainline/debian/dists/bookworm/inrelease the following signatures were invalid: expkeysig abf5bd827bd9bf62 nginx signing key <signing-key@nginx.com>
解决处理:
  1. 导入 Nginx.org GPG 密钥
curl -fSsL https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg > /dev/null

2. 验证密钥是否成功导入

gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg

3. 导入 Nginx.org APT 存储库

编辑文件为:/etc/apt/sources.list.d/nginx.list

Mainline 存储库 、稳定存储库 二选一!

要导入 Nginx Mainline 存储库,请使用:

echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

或者,对于 Nginx 稳定存储库:

echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

解决 apt-get update 从 packages.sury.org 更新 apache2 与 php 时签名无效的错误

apt-get update 显示错误,从 packages.sury.org 更新 apache2 与 php 时签名无效,如下显示:

错误:6 https://packages.sury.org/apache2 bookworm InRelease
  下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

错误:7 https://packages.sury.org/php bookworm InRelease
  下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

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

Err:6 https://packages.sury.org/apache2 bookworm InRelease
The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

Err:7 https://packages.sury.org/php bookworm InRelease
The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: 校验数字签名时出错。此仓库未被更新,所以仍然使用此前的索引文件。GPG 错误:https://packages.sury.org/apache2 bookworm InRelease: 下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: 校验数字签名时出错。此仓库未被更新,所以仍然使用此前的索引文件。GPG 错误:https://packages.sury.org/php bookworm InRelease: 下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: 无法下载 https://packages.sury.org/apache2/dists/bookworm/InRelease 下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: 无法下载 https://packages.sury.org/php/dists/bookworm/InRelease 下列签名无效: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

————————————————————————————————–

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/apache2 bookworm InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php bookworm InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: Failed to fetch https://packages.sury.org/apache2/dists/bookworm/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

W: Failed to fetch https://packages.sury.org/php/dists/bookworm/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

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

解决办法:

参考 packages.sury.org 站点 README.txt 文件的脚本。

apache2 https://packages.sury.org/apache2/README.txt
php https://packages.sury.org/php/README.txt

apache2

apt-get update
apt-get -y install lsb-release ca-certificates curl
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb
sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-apache2.gpg] https://packages.sury.org/apache2/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/apache2.list'
apt-get update

php

apt-get update
apt-get -y install lsb-release ca-certificates curl
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb
sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
apt-get update

【END】