I have updated my certificates to wildcard. All seems to be working except running the renewal process via crontab. I’ve followed this guide and am using cloudflare api to authenicate.
The issue I am having now is when auto renewal via cron.
* * * * * certbot renew
I receive this error.
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.28.0', 'console_scripts', 'certbot')()
File "/usr/lib/python3/dist-packages/certbot/main.py", line 1310, in main
plugins = plugins_disco.PluginsRegistry.find_all()
File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 206, in find_all
plugin_ep = PluginEntryPoint(entry_point)
File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 52, in __init__
self.plugin_cls = entry_point.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2290, in load
self.require(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2307, in require
items = working_set.resolve(reqs, env, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 854, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (certbot 0.28.0 (/usr/lib/python3/dist-packages),
Requirement.parse('certbot>=0.39.0'))
2019-12-09 00:00:17,903:ERROR:certbot.log:An unexpected error occurred:
However, if I run the renewal via cli, it runs fine. Just via crontab.
An unexpected error occurred:
pkg_resources.VersionConflict: (certbot 0.28.0 (/usr/lib/python3/dist-packages), Requirement.parse('certbot>=0.39.0'))
Please see the logfile '/tmp/tmprrnvc53_' for more details.
So you do have two certbots…
I would delete: /usr/bin/certbot
And also update the cronjob to something less monotonous.
This * * * * * certbot renew
means it will run on every minute of every hour of every day (all year long).
I don’t know where you got that from but it is very unusual and extremely overburdening.
I renamed the certbot file as suggested and I get this error. I also tried to rename the other file and got the same error. I only rename one and kept the other as is.
/bin/sh: 1: certbot: not found
The content of the two certbot files are as follows.
/usr/local/bin/certbot
#!/usr/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'certbot==1.0.0','console_scripts','certbot'
__requires__ = 'certbot==1.0.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('certbot==1.0.0', 'console_scripts', 'certbot')()
)
/usr/bin/certbot
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'certbot==0.28.0','console_scripts','certbot'
__requires__ = 'certbot==0.28.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('certbot==0.28.0', 'console_scripts', 'certbot')()
)
Update: I got it working.
For some reason, my eyes think Certbot==1.0.0 is smaller than Cert==0.28.0. I fiddle with the 2 files again and made both files identical using the Certbot=1.0.0 file. Ran the ‘certbot renew’ via cron and it works. I think both files are required and one of them was outdated or never was updated when I had to update Certbot a few months back.
The only reason you are thinking this is because you don't use a path in your call to certbot; so the O/S path is used (for that particular user).
Apparently the current user path and the root user path are different.
Try these and compare: which certbot sudo which certbot
Or just specify the exact path in the cronjob to the newer version and be done with the old one.
I’m a bit confused…
The version of file /usr/bin/certbot was 0.28.0 not 1.0.0.
Is that still the case?
Did you overwrite /usr/bin/cerbot with /usr/local/bin/certbot ?
The OS was using this file /usr/bin/certbot which had the older version. I overwrite it when I was testing which file the OS was using, then delete /usr/local/bin/certbot .