Certbot cron job failed

A cron job has failed with:

Hook command “/bin/run-parts /etc/letsencrypt/pre-hook.d/” returned error code 1
Error output from run-parts:
run-parts: failed to open directory /etc/letsencrypt/pre-hook.d/: No such file or directory

The command executed by cron was:

test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(3600))’ && certbot -q renew --pre-hook ‘/bin/run-parts /etc/letsencrypt/pre-hook.d/’ --post-hook ‘/bin/run-parts /etc/letsencrypt/post-hook.d/’ --renew-hook ‘/bin/run-parts /etc/letsencrypt/renew-hook.d/’

I had previously followed the instructions referred to in this post after updating Certbot

What’s the best way out of this? Can I re-install and keep my existing certificates? How?

@bmw, is this possibly a packaging issue related to the reorganization of the Debian package?

Hi @flymikeG!
It seems like you might have added unnecessary flags to your renewal - but don’t worry it should be easy enough to fix!
My first question is how are you managing renewal? Do you have a cron job set up? If so what does it look like?
My second question is what your server set-up is, are you actually in need of running an renewal scripts (these would be things like manually turning off your webserver before renewal or manually reloading it after renewal)
If not, the easiest thing to do would be to edit your cron job to remove references to those directories, since you don’t have them on your system so likely don’t need to run any scripts inside of them.
Once you do that renewal should just work - you won’t need to re-install your existing certificates, you’ll just need to run renew again.
Let me know if that works, and I’m happy to answer any other questions you have!

@SwartzCr, I believe that particular renewal cron job was created by a package, not by @flymikeG.

The cron job is:

0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(3600))’ && certbot -q renew --pre-hook ‘/bin/run-parts /etc/letsencrypt/pre-hook.d/’ --post-hook ‘/bin/run-parts /etc/letsencrypt/post-hook.d/’ --renew-hook ‘/bin/run-parts /etc/letsencrypt/renew-hook.d/’

No, I don’t need renewal scripts, so I will remove everything following ‘certbot -q renew’, and also remove the same parameters from the .conf files in /etc/letsencrypt/renewal

Thanks for the help.

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