Signatures were invalid [FIX] Failed to fetch packages.sury.org Debian

Last updated on February 28th, 2024 at 11:09 am.

Apt update Error messages on Debian:

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

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 <>

Fix the issue

If you are using HestiaCP try the following for either php or APache2.

For PHP nginx setup:

curl -sSlo /usr/share/keyrings/sury-keyring.gpg https://packages.sury.org/php/apt.gpg

For Apache2 users:

curl -sSlo /usr/share/keyrings/apache2-keyring.gpg https://packages.sury.org/apache2/apt.gpg

Credit for the above is here on the Hestia Forum.

If the above doesn’t work, try the following steps.

First, delete the sury gpg key file

List the gpg keys on your system:

 ls -l /etc/apt/trusted.gpg.d

Remove the sury gpg file as listed above. The filename starts with debsuryorg-archive .

sudo rm /etc/apt/trusted.gpg.d/debsuryorg-archive.gpg~

Then update to confirm that the error is no longer being shown :

sudo apt update

Second, re-add the Sury PPA

Add the DEB.SURY.ORG PPA again:

#For a PHP user
curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x ; sudo apt update

#If you use Nginx mainline from Sury PPA
curl -sSL https://packages.sury.org/nginx-mainline/README.txt | sudo bash -x

#If you use Nginx stable from Sury PPA
curl -sSL https://packages.sury.org/nginx/README.txt | sudo bash -x

Update and upgrade your packages as needed :

sudo apt update && sudo apt upgrade

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!