Let's Encryptの証明書更新に失敗した時の対応メモ

エラー文

# /usr/local/letsencrypt/certbot-auto renew && /sbin/service httpd restart > /dev/null 2>&1
Upgrading certbot-auto 0.9.3 to 0.11.1...
Replacing certbot-auto...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Traceback (most recent call last):
  File "/root/.local/share/letsencrypt/bin/letsencrypt", line 7, in 
    from certbot.main import main
  File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/certbot/main.py", line 11, in 
    import zope.component
  File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/zope/component/__init__.py", line 16, in 
    from zope.interface import Interface
ImportError: No module named interface

復旧時に実行したコマンド

/root/.local/share/letsencrypt/bin/letsencrypt に問題がある様子だったので、一旦削除または/tmpなどの別ディレクトリへ移動してから再試行した。

# rm /root/.local/share/letsencrypt/bin/letsencrypt
# unset PYTHON_INSTALL_LAYOUT
# /usr/local/letsencrypt/certbot-auto renew && /sbin/service httpd restart > /dev/null 2>&1

参考