Let's Encrypt で "ImportError: cannot import name _remove_dead_weakref" になって ./certbot-auto renew ができない時


現象

エラーはこんなかんじ

./certbot-auto renew
Requesting to rerun ./certbot-auto with root privileges...
./certbot-auto has insecure permissions!
To learn how to fix them, visit https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979/
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 5, 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

やってみた対処方法

Let's Encrypt のコミュニティのフォーラムの記事 Cannot renew certificate “ImportError: cannot import name _remove_dead_weakref”の bmw さんの投稿を参考に、とりあえず本体の方を消してみる

sudo rm -rf /opt/eff.org

なおった!

./certbot-auto renew
Requesting to rerun ./certbot-auto with root privileges...
Bootstrapping dependencies for Debian-based OSes... (you can skip this with --no-bootstrap)
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
Get:3 http://ports.ubuntu.com bionic-security InRelease [88.7 kB]
Hit:4 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease            
Fetched 88.7 kB in 2s (46.0 kB/s)                                              

bmw さん、ありがとう!

感想

前述の bmw さん、お名前が Brad Warren さんっておっしゃるそうなんですが、m ってどこからきてるんだろう?