Key takeaways
- Three different faults all get called the Sury certificate expired: a failed TLS check, an expired repository signing key (EXPKEYSIG), and a release that was removed from the repository.
- A TLS error is almost always on your side: a wrong clock, an old ca-certificates package or a proxy that inspects HTTPS. Never fix it by turning certificate checks off.
- EXPKEYSIG means your copy of the key is old. Download the current debsuryorg-archive-keyring package with curl and install it with dpkg, because apt cannot fetch it from the refused repository.
- A 404 and does not have a Release file means your release is gone from packages.sury.org. Upgrade the system; the PHP packages for that release will not come back.
Search for "packages.sury.org certificate has expired" and you find forum threads where three different problems are mixed up. They show different error lines and need different fixes: a TLS certificate check that fails, a repository signing key that your server thinks has expired, and an old repository address or a release that was removed. This guide shows the exact apt output for each, how to tell them apart in one minute, and the fix for each. Every command below was run in Debian 12 and Ubuntu 24.04 containers on 29 November 2026; where we forced an error by moving the clock, we say so.
packages.sury.org is the repository of PHP packages for Debian and Ubuntu run by Ondřej Surý (deb.sury.org). Ubuntu users who added the older ppa:ondrej/php should know it is now frozen; how to move is in our Ondrej PHP PPA guide.
Read the error first
| What apt or curl says | Cause | Section |
|---|---|---|
Certificate verification failed, certificate has expired, server certificate verification failed |
The TLS check of the connection | Cause 1 |
The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 |
Your copy of the signing key is out of date | Cause 2 |
404 Not Found and does not have a Release file |
Your release was removed from the repository | Cause 3 |
Run these four commands first. Together they answer which of the three you have:
date -u
openssl s_client -connect packages.sury.org:443 -servername packages.sury.org </dev/null 2>/dev/null | openssl x509 -noout -issuer -enddate
grep -rn "sury" /etc/apt/sources.list /etc/apt/sources.list.d/
gpg --show-keys /usr/share/keyrings/debsuryorg-archive-keyring.gpg
The first shows whether your clock is right. The second shows who issued the certificate your server actually receives and when it ends: on 29 November 2026 that was Certainly Intermediate R1, ending 19 December 2026. If you see another issuer, something on your network is replacing the certificate. The third lists your Sury source lines and the release name in them. The fourth prints the expiry dates of your copy of the signing key.
Cause 1: the TLS certificate check fails
This is the error the search phrase is really about. curl and wget report it while fetching the key or the setup script, apt while reading the repository. To show the exact lines, we ran apt and curl on Debian 12 with the clock moved to 15 January 2027 (with faketime), after the end date of the certificate the server used that day:
Err:1 https://packages.sury.org/php bookworm InRelease
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 151.101.207.52 443]
W: Failed to fetch https://packages.sury.org/php/dists/bookworm/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 151.101.207.52 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.
curl: (60) SSL certificate problem: certificate has expired
Older systems word it differently. The error text as reported in issue 1082 on Debian 8 was server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none, and in issue 1729 wget printed ERROR: The certificate of 'packages.sury.org' has expired.
The certificate the server used that day was valid for 30 days, from 19 November to 19 December 2026, so it is replaced often and a real lapse there is rare. When the maintainer looked at issue 1729 in March 2022, he found a valid certificate and closed it, suggesting the reporter's ca-certificates package was out of date. Look on your own side, in this order:
- The clock. If
date -uis off by more than a little, every certificate looks expired or not yet valid. Turn on your system's time sync (systemd-timesyncd or chrony), which is easy to lose on a virtual machine restored from an old snapshot. - The CA bundle. An old
ca-certificatespackage may not trust the chain the server sends today. Update it from your distribution:sudo apt-get install -y --only-upgrade ca-certificates. On a release that no longer gets updates this cannot be fixed properly, which leads to Cause 3. - A proxy that inspects HTTPS. If the issuer from the
opensslcommand above is your company firewall or antivirus, its own certificate is the one that expired or is not trusted. Ask whoever runs it, or add its CA to the server's bundle.
Do not work round it with curl -k, [trusted=yes] or Acquire::https::Verify-Peer "false". The packages install as root, and those switches let anyone in the path give you different ones.
Cause 2: the signing key expired (EXPKEYSIG)
Here the connection is fine. apt downloads the repository index, checks its signature against the key on your server, and finds that copy of the key expired. We forced it on Debian 12 by reading a local copy of the bookworm index with the clock set to 1 March 2028, after the key's current end date:
Err:1 file:/srv/sury bookworm InRelease
The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: GPG error: file:/srv/sury bookworm InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
E: The repository 'file:/srv/sury bookworm InRelease' is not signed.
Against the live server the address in those lines is https://packages.sury.org/php, as in the error text reported in issue 1575.
The key with ID B188E2B695BD4743 is not replaced; its dates are extended. The listing in issue 2074 (February 2024) showed it expiring on 28 February 2026, with its encryption subkey ending 16 February 2024. The current debsuryorg-archive-keyring package (version 2025.11.18, read 29 November 2026) carries an expiry of 4 February 2028. So a server shows EXPKEYSIG when it holds an old copy: a php.gpg file copied into /etc/apt/trusted.gpg.d/ years ago, a base image built long ago, or an automation role that ships its own key file.
Since 2024 the maintainer ships the key as a package, so that apt updates it with everything else (issue 2074). Once the key has expired, though, apt refuses the repository and cannot fetch that package from it. Download it directly and point your source line at the packaged keyring:
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 rm -f /etc/apt/trusted.gpg.d/php.gpg
sudo apt-get update
We ran exactly this on Debian 12 and Ubuntu 24.04, starting from the old style setup (key in /etc/apt/trusted.gpg.d/php.gpg, source line without signed-by). apt-get update then read the repository without warnings, and gpg --show-keys showed the 2028 dates. If your Sury source is a .sources file instead of php.list (the newer format, written for example by debsuryorg-repository-php), keep that file and make sure it says Signed-By: /usr/share/keyrings/debsuryorg-archive-keyring.gpg, rather than adding a second source.
The signed-by part matters. Since version 2025.03.11 the keyring package warns when it finds a Sury source line without it (issue 2268), because the plan described there is to stop placing the key in /etc/apt/trusted.gpg.d/, which is where a line without signed-by finds it.
Cause 3: an old repository address or a removed release
The third case looks like a failure of the repository, but the repository is simply no longer there for your system. This is what Debian 12 printed on 29 November 2026 with an extra line for buster:
Err:6 https://packages.sury.org/php buster Release
404 Not Found [IP: 151.101.207.52 443]
E: The repository 'https://packages.sury.org/php buster Release' does not have a Release file.
On that day packages.sury.org answered for bullseye, bookworm, trixie, jammy, noble and resolute, and returned 404 for stretch and buster. The maintainer removes a release's packages shortly after its end of life: Debian 9 on 2 July 2022 (issue 1785) and Debian 10 on 1 July 2024 (issue 2098), where he also said requests to keep them longer would not be discussed. For releases past that point he names the paid PHP LTS by Freexian as the place packages are still built.
What to do:
- The release is gone. Upgrade the system to a supported release. Until then, remove the dead source line so the rest of
apt-get updateworks, and treat the installed PHP as frozen. A system this old usually also has the out of date CA bundle from Cause 1. - You upgraded the system but not the source line. If
grepshows the old name (for examplebookwormon a Debian 13 server), rewrite the line with thesh -ccommand from Cause 2, which fills in the current name withlsb_release -sc. If the source came from thedebsuryorg-repository-phppackage, its own file says to runsudo dpkg-reconfigure debsuryorg-repository-phpafter a release upgrade. - You still use ppa:ondrej/php. There is no error, only no updates: the PPA is frozen. The four commands to move are in the Ondrej PHP PPA guide.
Keep it from coming back
- Install the key as the
debsuryorg-archive-keyringpackage, not as a copied file, so it is renewed with your normal updates. - Pin it with
signed-byon the Sury line only. - Rebuild container base images regularly, so they do not carry a two year old key or CA bundle.
- Watch your releases' end of life dates. The PHP packages for a release disappear with it, and no request brings them back.
- Keep upgrades out of deploys. If the repository is unreachable for any reason, installed PHP keeps running; it only stops you from installing or upgrading.
A control panel helps with the routine part. RespireCloud installs PHP versions from the distribution or from the Sury repository with a pinned key, and runs one PHP-FPM pool per hosting account and PHP version (websites and PHP). Where PECL is the problem rather than apt, see PECL down, what to do.
Sources
Read on 29 November 2026: deb.sury.org (the issue tracker is now on Codeberg; the older GitHub tracker, cited above, is archived), packages.sury.org/php/README.txt, the ppa:ondrej/php page on Launchpad, and the certificate and key details printed by the commands above.
Questions
Is the packages.sury.org certificate really expired?
Rarely. On 29 November 2026 the server presented a valid certificate chained to the Starfield Root G2 authority and valid for 30 days. When the maintainer looked into earlier reports he found the server fine and pointed at the clients.
What does EXPKEYSIG B188E2B695BD4743 mean?
apt checked the repository's signature with the copy of the DEB.SURY.ORG Automatic Signing Key on your server and found that copy expired. The key itself has been extended; install the current debsuryorg-archive-keyring package to get the new dates.
Can I just set trusted=yes or turn off Verify-Peer?
You can, but then anyone between you and the repository can feed your server their own PHP packages, which run as root during install. Fix the clock, the CA bundle or the key instead.
Why does packages.sury.org return 404 for buster or stretch?
The maintainer deletes a release's packages shortly after that release reaches end of life. Debian 9 went in July 2022 and Debian 10 in July 2024. Upgrade the system to Debian 12 or 13.