Cannot renew, not writeable?

I ran this command:
certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"

It produced this output:
The following error was encountered:

[Errno 13] Permission denied: ‘/var/log/letsencrypt’

Either run as root, or set --config-dir, --work-dir, and --logs-dir to writeable paths.

I Ran The Same Command as root user:
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Processing /etc/letsencrypt/renewal/

Cert not yet due for renewal

The following certs are not due for renewal yet:

/etc/letsencrypt/live/ expires on 2019-09-11 (skipped)

No renewals were attempted.

No hooks were run.

It looks like certbot is saying that nothing needs to be renewed, but obviously the certificate does need to be renewed because when I go to the site the certificate is invalid because it expired. Do I force it somehow?

Hi @bennyandthejets82,

That seems odd that certbot doesn’t think you should renew.

$ echo | openssl s_client -connect -servername 2>/dev/null| openssl x509 -noout -startdate -enddate
notBefore=Apr 14 23:01:20 2019 GMT
notAfter=Jul 13 23:01:20 2019 GMT

[edited: potentially risky cleanup command renewed]

1 Like

Hi @bennyandthejets82

checking your domain there is a new certificate -

Issuer not before not after Domain names LE-Duplicate next LE
Let’s Encrypt Authority X3 2019-06-13 2019-09-11,
2 entries
Let’s Encrypt Authority X3 2019-04-14 2019-07-13,
2 entries
Let’s Encrypt Authority X3 2019-02-13 2019-05-14,
2 entries

So Certbot doesn’t see something to do.

But you don’t use that certificate, instead you use the older, expired:
2 days expired, - 2 entries

So first action: Restart your nginx. If that doesn’t help, try

sudo certbot -d -d --reinstall -i nginx

to see if Certbot is able to install the certificate.

If that doesn’t help, share your nginx config:

nginx -T

What’s your certbot version?

certbot --version

I would never recommend deleting existing certificates this way. For one thing, you're likely to break your nginx configuration and prevent nginx from starting at all. For another thing, without deleting /etc/letsencrypt/archive as well, you can get into an inconsistent state.

When a certificate has been renewed but isn't being used by the web server, the problem is generally with the web server configuration rather than with the certificate.


That’s a good point, thank you @schoen.

1 Like

@JuergenAuer wow it works now and it was as simple as restarting nginx… I though because I included that in the post-hook that I would not have to, but I ran service nginx reload and then service nginx restart and it works now, haha

@Phil @schoen thx but it was actually just as easy as restarting nginx… I though it was done but apparently not because when I did it again the certificate started to work.

thx everyone

1 Like

If you use that --post-hook or if you use -i nginx — and if the fact that you did so is saved in the renewal configuration file in /etc/letsencrypt/renewal — then you should get your nginx restarted automatically whenever Certbot renews the certificate. But if not (for example, if you originally used certbot certonly), then maybe not!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.