Whenever I run any certbot command I receive the following error (see below).
I am running Ubuntu 18.04. I have tried completely uninstalling and reinstalling Certbot via snap. I have also tried reinstalling Python3 and the python packages mentioned in the error (python3_josepy, python3_openssl, python3_cryptography. My gcc version is 7.5.0.
I had no issues when I installed Certbot a few months ago so I am confused as to what caused this current issue. Any help or insight would be greatly appreciated.
$ sudo certbot certificates
Traceback (most recent call last):
File "/snap/certbot/2611/bin/certbot", line 5, in
from certbot.main import main
File "/snap/certbot/2611/lib/python3.8/site-packages/certbot/main.py", line 6, in
from certbot._internal import main as internal_main
File "/snap/certbot/2611/lib/python3.8/site-packages/certbot/_internal/main.py", line 19, in
import josepy as jose
File "/snap/certbot/2611/lib/python3.8/site-packages/josepy/init.py", line 40, in
from josepy.json_util import (
File "/snap/certbot/2611/lib/python3.8/site-packages/josepy/json_util.py", line 14, in
from OpenSSL import crypto
File "/snap/certbot/2611/lib/python3.8/site-packages/OpenSSL/init.py", line 8, in
from OpenSSL import SSL, crypto
File "/snap/certbot/2611/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in
from OpenSSL.crypto import (
File "/snap/certbot/2611/lib/python3.8/site-packages/OpenSSL/crypto.py", line 21, in
from cryptography import utils, x509
File "/snap/certbot/2611/lib/python3.8/site-packages/cryptography/x509/init.py", line 6, in
from cryptography.x509 import certificate_transparency
File "/snap/certbot/2611/lib/python3.8/site-packages/cryptography/x509/certificate_transparency.py", line 10, in
from cryptography.hazmat.bindings._rust import x509 as rust_x509
ImportError: /snap/core20/current/lib/x86_64-linux-gnu/libgcc_s.so.1: undefined symbol: __letf2, version GCC_4.3.0
Actually I may be having an issue with apt. sudo apt update gives the following error:
Hit:1 Index of /ubuntu bionic InRelease
Hit:2 Index of /ubuntu bionic-updates InRelease
Hit:3 Index of /ubuntu bionic-backports InRelease
Hit:4 Index of /232905/apt/ubuntu bionic InRelease
Hit:5 http://apt-longview.linode.com bionic InRelease
Hit:6 Index of /certbot/certbot/ubuntu bionic InRelease
Get:7 Index of /ubuntu bionic-security InRelease [88.7 kB]
Hit:8 Index of /ubuntu bionic InRelease
Hit:9 Index of /ondrej/php/ubuntu bionic InRelease
Fetched 88.7 kB in 1s (81.4 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
Well, I tried installing Certbot on Linode on a similar, fully updated Ubuntu 18.04 server:
processor : 1
vendor_id : AuthenticAMD
cpu family : 23
model : 1
model name : AMD EPYC 7601 32-Core Processor
and it works OK for me.
Unfortunately I'm not sure what's going on. I wonder if some core libraries on your server have been overrwritten. Or maybe you have LD_LIBRARY_PATH (or a similar mechanism) set and it's doing something weird.
One thing you could try is to reinstall these packages on your host system, but it's a long shot:
If not, and unless you want to reinstall your Ubuntu server, you might need to uninstall the Certbot snap and install Certbot from the pip instructions. Or use another ACME client.
Thank you so much for your efforts. I tried the two commands you suggested but it didn't resolve the issue. I suspect that there is some deeper issue with the server and a reinstall of Ubuntu may be the only fix.
At some point I will rebuild the problem server with the latest Ubuntu version and I am sure that will resolve the original issue. In the meantime Certbot works fine on my Ubuntu 20 server so I can use it to create the certificates and then manually copy them to the problem server.
I use the Linode backup service and I found that I had a backup from the day before this error started showing up. I restored my Linode from that backup and now everything is working fine. I did a certbot renew --dry-run and it was successful.
Thanks again to all who helped here! Your input led me to the conclusion that more drastic action was needed and that is what made me think of restoring from a backup.