Re-install procedure

Since doing a release upgrade from Ubuntu 16.04.6 LTS to 18.04.3 LTS, various things broke, some of which are now fixed. Can you help me fix Certbot & letsencrypt? I've got the web server running OK now except it only works under HTTP and not through HTTPS. I came across a recommended solution involving 'pip' and 'python' -

which I don't understand and which doesn't seem to work anyway. My system seems to have both python 2.7 and python 3.6 on it. Apparently 2.7 is now deprecated. But I don't know how that impacts certbot and/or letsencrypt. Rather than mess with that, I thought it maybe best to uninstall (if required) and re-install. Is uninstall recommended and if so, how?

My domain is: westnab.com

I ran this command:

~/letsencrypt/letsencrypt-auto renew

and got this output:

/home/andy/letsencrypt/letsencrypt-auto has insecure permissions!
To learn how to fix them, visit https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979/
Upgrading certbot-auto 0.40.1 to 1.1.0...
Replacing certbot-auto...
Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt: 
Traceback (most recent call last):
  File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 6, in <module>
    import logging.handlers
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

My web server is (include version):
Apache 2.4.9
The operating system my web server runs on is (include version):
Ubuntu 18.04.3 LTS (recently release upgraded from 16 which seems to have broken things)
My hosting provider, if applicable, is:
N/A - server is at home on domestic ISP link
I can login to a root shell on my machine (yes or no, or I don't know):
yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
no
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

Traceback (most recent call last):
  File "/opt/eff.org/certbot/venv/bin/certbot", line 7, in <module>
    from certbot.main import main
  File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 6, in <module>
    import logging.handlers
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
1 Like

Python virtual environments contain a copy of the system’s Python installation. When something major happens like an OS upgrade, it can stop working.

You can rename or delete /opt/eff.org/certbot/ to force certbot-auto to reinstall itself.

3 Likes

I renamed the certbot folder as advised and then ran:

cd letsencrypt
./letsencrypt-auto -v

(Some interactive questions needed answering, then everything is working fine).Thanks!

2 Likes

Renewing certificate today worked OK, but with the following warning:

Installing Python packages...
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Installation succeeded.

How do I upgrade Python? Or rather, since I appear to have Python 3.6 installed already (as noted previously), how do I get certbot to use that version instead of Python 2.7?

1 Like

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