Certbot renewal failed: find the cause
Certbot renews in the background, so the first sign of a failure is often the expired certificate. Work through these checks, fix the cause, then make sure the next failure reaches you.
Is the renewal scheduled?
Certbot renews through a scheduled task that calls certbot renew. On Linux, look for it in your
crontab (/etc/crontab or /etc/cron.*/*) or your systemd timers:
systemctl list-timers
If neither holds it, nothing is renewing. Certbot's instructions
show how to set one up for your system. Certificates obtained with --manual do not renew automatically
unless combined with authentication hook scripts.
Should it have renewed by now?
Since Certbot 4.0.0, a certificate is ready for renewal when less than a third of its lifetime remains, or half for
a lifetime of 10 days or less. Before that the line was a fixed 30 days. certbot certificates lists
each certificate with its expiry date and paths. A certificate past that line and not renewed means the task is
failing or not running.
Read the log and repeat the failure
Certbot keeps its logs in /var/log/letsencrypt by default. To repeat the renewal without saving a certificate:
sudo certbot renew --dry-run
A dry run uses the Let's Encrypt staging server.
Common causes
-
The HTTP challenge cannot reach the server. Let's Encrypt fetches a file under
/.well-known/acme-challenge/and starts on port 80, so a firewall or a closed port 80 fails it. -
The webroot moved. Certbot reuses the options from the first issue, so test the new path:
certbot renew --cert-name example.com --webroot-path /path/to/new/location --dry-run -
The port is taken. The standalone plugin binds the ports itself, so stop the web server around
it with
--pre-hookand--post-hook. - DNS changed. The name no longer points at this server, or the TXT record for a DNS challenge is not being written.
It renewed, and clients still get the old certificate
That is a different problem: the service has not loaded the new file. See the certificate renewed, but the server still serves the old one.
Hear about the next failure
certbot renew exits 1 only when a renewal attempt failed, and 0 both after a renewal and when nothing
was due, so a wrapper script can alert on a non-zero exit. That covers a failed attempt. It does not cover a timer
that stopped, a machine that was rebuilt, or a certificate that renewed and never loaded.
CertWatch covers those from outside, with nothing to install. It connects every hour, on every plan, works out when each certificate should renew, and alerts you when the renewal is late, so a certificate certbot renews on schedule never alerts. It sees that no new certificate is being served, not why, so the alert's steps start with your client's log.
Check a hostname now with the free checker, no account needed, or add it to CertWatch to be told when a renewal is late.