+1 vote
in Operating Systems by (8.5k points)

When I run the "apt update" command on the terminal of Debian 11, I get the following message:

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 bullseye 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/bullseye/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.

How can I fix the error?

1 Answer

+1 vote
by (348k points)
selected by
 
Best answer

You need to delete the old "php.gpg" from your system and download the updated PHP "apt.gpg" to fix the error.

Run the following two commands on the terminal to fix the issue:

Remove the old php.gpg:

rm /etc/apt/trusted.gpg.d/php.gpg

Download the new gpg file:

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


...