2

CentOS 6, certbot 0.16.0. When I run it manually as root (not by sudo) everything works. When I setup /etc/crontab to run it automatically it returns an error:

Error: couldn't get currently installed version for //.local/share/letsencrypt/bin/letsencrypt: 
//.local/share/letsencrypt/lib64/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the   Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning
An unexpected error occurred:
ContextualVersionConflict: (setuptools 0.9.8 (/.local/share/letsencrypt/lib/python2.6/site-packages), Requirement.parse('setuptools>=1.0'), set(['certbot']))
Please see the logfile '/tmp/tmp5jOtY3' for more details.`

cat /tmp/tmp5jOtY3

2017-07-31 11:37:02,325:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "//.local/share/letsencrypt/bin/letsencrypt", line 11, in <module>
sys.exit(main())
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/certbot/main.py", line 723, in main
plugins = plugins_disco.PluginsRegistry.find_all()
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/certbot/plugins/disco.py", line 203, in find_all
plugin_ep = PluginEntryPoint(entry_point)
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/certbot/plugins/disco.py", line 50, in __init__
self.plugin_cls = entry_point.load()
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/pkg_resources/__init__.py", line 2201, in load
self.require(*args, **kwargs)
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/pkg_resources/__init__.py", line 2218, in require
items = working_set.resolve(reqs, env, installer)
  File "//.local/share/letsencrypt/lib64/python2.6/site-packages/pkg_resources/__init__.py", line 835, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
ContextualVersionConflict: (setuptools 0.9.8 (/.local/share/letsencrypt/lib/python2.6/site-packages), Requirement.parse('setuptools>=1.0'), set(['certbot']))

cat /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

27  18  *  *  * root /opt/certbot-auto renew --quiet --no-self-upgrade

I tried Let's Encrypt community and found someone having this exact problem, but the only help offered was migration to bash script. I would prefer to fix the official script instead.

Let's Encrypt forum post

3

This is the issue:

HOME=/

To fix it HOME variable with /root value needs to be passed to the script:

env HOME=/root /path/to/certbot-auto
| improve this answer | |
  • This can break other entries in your crontab if they aren't all running as root. You'll see an 'ERROR chdir failed (/root/): Permission denied" message in /var/log/cron on centos at least – xref Aug 9 '17 at 6:52
  • 1
    To @xref's point, if you do have other cron entries that aren't running as root, you're better off setting the path just for certbot by changing the command to env PATH=/root /opt/certbot-auto. – Scott Buchanan Aug 21 '17 at 15:30
  • @ScottSB Almost... HOME, not PATH: env HOME=/root /path/to/certbot-auto – scoota269 Aug 30 '17 at 4:02
  • Ah, yes, good point. :-) – Scott Buchanan Aug 30 '17 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.