在 Debian 12 系统的 SURY 源中出现 “EXPKEYSIG B188E2B695BD4743”错误的解决办法

今天在更新系统之时再次出现与EXPKEYSIG有关的错误,因此又是需要进行一番处理的说!

前因

下午时分在再次执行apt update的时候又出现一些警告事项,在执行完毕过后再次定位到具体的警告错误:

Hit:1 http://mirrors.cloud.aliyuncs.com/debian bookworm InRelease
Hit:2 http://mirrors.cloud.aliyuncs.com/debian-security bookworm-security InRelease
Hit:3 http://mirrors.cloud.aliyuncs.com/debian bookworm-updates InRelease
Hit:4 http://mirrors.cloud.aliyuncs.com/debian bookworm-backports InRelease
Hit:5 https://nginx.org/packages/mainline/debian bookworm InRelease
Hit:6 https://apt.myvestacp.com/bookworm bookworm InRelease
Get:7 https://packages.sury.org/php bookworm InRelease [6,133 B]
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>
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
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/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.

事关 PHP 的后续版本更新,还是需要即刻就着手解决这个问题的。

同样的一开始还是不可避免的走了些弯路,这一点点差错就导致没能一下子解决,但最总还是成功的在官网中找到解决办法。

后果

根据官网中给出的README.txt摘取几条有用的命令执行即可:

apt-get update
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb
apt-get update

执行完毕之后即可解决The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key 的错误问题。

题外话

还是记录几条执行无效的命令以供参考:

wget https://packages.sury.org/php/apt.gpg -O /etc/apt/trusted.gpg.d/php-sury.gpg
gpg --import /etc/apt/trusted.gpg.d/php-sury.gpg
apt clean
apt update

再顺便附带一份官网给出的README.txt吧:

#!/bin/sh
# To add this repository please do:

if [ "$(whoami)" != "root" ]; then
    SUDO=sudo
fi

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

参考

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

ChiuYut

2026年03月17日

发布者

ChiuYut

咦?我是谁?这是什么地方? Ya ha!我是ChiuYut!这里是我的小破站!