Cannot RENEW SSL cert

Hi,

I’ve recently upgraded to Ubuntu 18.04.01 and I’m running EE v3.8.1.

Now I’m getting the same error when trying to renew SSL on all my sites, and I don’t know what to do!

The logs are giving me the following:

Command Error: 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 from certbot.main import main File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py”, line 5, in import logging.handlers File “/usr/lib/python2.7/logging/init.py”, line 26, in import sys, os, time, cStringIO, traceback, warnings, weakref, collections File “/usr/lib/python2.7/weakref.py”, line 14, in from _weakref import ( ImportError: cannot import name _remove_dead_weakref

for the full log, see http://paste.debian.net/hidden/dbd3770b/

Now I have 7 days left on the certificate… Does anyone have any idea what to do?

so I’m wondering if the error is caused by this:

Command Error: From https://github.com/letsencrypt/letsencrypt bbbbbbbb…aaaaaaaa nginx-parsing-rehaul -> origin/nginx-parsing-rehaul error: Your local changes to the following files would be overwritten by merge: letsencrypt-auto Please commit your changes or stash them before you merge. Aborting

(key replaced by bb…aa…)

or by this:

Command Error: 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 from certbot.main import main File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py”, line 5, in import logging.handlers File “/usr/lib/python2.7/logging/init.py”, line 26, in import sys, os, time, cStringIO, traceback, warnings, weakref, collections File “/usr/lib/python2.7/weakref.py”, line 14, in from _weakref import ( ImportError: cannot import name _remove_dead_weakref

… but in either case I don’t know how to fix it… The fault is occurring with the same message on all my sites.

Please help! :slight_smile:

A wild guess: update to python=2.7.14 if you did not do it already

Hmm… I have both 2.7 and 3.6 but not sure how I can see the subversion… Anyhow I upgraded to the latest version from Ubuntu (coincidentally there was an update available) listed below.

python-apport/bionic-updates,bionic-updates 2.20.9-0ubuntu7.4 all [upgradable from: 2.20.9-0ubuntu7.3] python-problem-report/bionic-updates,bionic-updates 2.20.9-0ubuntu7.4 all [upgradable from: 2.20.9-0ubuntu7.3] python3-apport/bionic-updates,bionic-updates 2.20.9-0ubuntu7.4 all [upgradable from: 2.20.9-0ubuntu7.3] python3-distupgrade/bionic-updates,bionic-updates 1:18.04.26 all [upgradable from: 1:18.04.25] python3-problem-report/bionic-updates,bionic-updates 2.20.9-0ubuntu7.4 all [upgradable from: 2.20.9-0ubuntu7.3]

Sorry to say that renewing SSL Certs still fails. Anyway, thanks for the hint.

Any other ideas? Should I update Python with a custom repo?

This sounds close to your problem. Maybe it helps:

The error is coming from the Python standard library on your system. I think there is either a problem with the Python installation or the virtual environment used by Certbot.

First, I’d try running sudo rm -rf /opt/eff.org and running letsencrypt-auto again.

If you still get the issue, do you get the same ImportError when you run:

python2 -c ‘import weakref’ If so, you should run sudo rm -rf /opt/eff.org, try reinstalling python from apt-get, and running letsencrypt-auto again.

If not, do you get the error when you run:

cd $(mktemp -d) virtualenv -p python2 venv ./venv/bin/python -c ‘import weakref’ If so, you should also run sudo rm -rf /opt/eff.org, but try reinstalling the virtualenv package and running letsencrypt-auto again.

as pasted from here: https://community.letsencrypt.org/t/cannot-renew-certificate-importerror-cannot-import-name-remove-dead-weakref/58148/3

Brilliant!! I’m so relieved!

It turns out that just by removing the /opt/eff.org directory the problem is resolved - so somehow something went wrong with the contents there.

Thanks so much for your help, and I hope your solution will also help others (by the way, I did look around for older posts for a solution, but did not manage to find the one you mention… probably because all my search terms included ‘letsencrypt’ and I didn’t think to search for ‘certificate’).

Anyway, thanks again and have a great day.

Good to know it is resolved.