Error then running certbot

I ran this command: certbot

It produced this output:

:~# certbot
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.40.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 10, in <module>
    import josepy as jose
  File "/usr/lib/python3/dist-packages/josepy/__init__.py", line 41, in <module>
    from josepy.interfaces import JSONDeSerializable
  File "/usr/lib/python3/dist-packages/josepy/interfaces.py", line 7, in <module>
    from josepy import errors, util
  File "/usr/lib/python3/dist-packages/josepy/util.py", line 7, in <module>
    import OpenSSL
  File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/usr/lib/python3/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/usr/lib/python3/dist-packages/cryptography/x509/base.py", line 18, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/usr/lib/python3/dist-packages/cryptography/x509/extensions.py", line 20, in <module>
    from cryptography.hazmat.primitives import constant_time, serialization
  File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/constant_time.py", line 11, in <module>
    from cryptography.hazmat.bindings._constant_time import lib
ModuleNotFoundError: No module named '_cffi_backend'

My web server is (include version):

Server version: Apache/2.4.41 (Ubuntu)
Server built: 2021-09-28T11:00:45

The operating system my web server runs on is (include version):

Ubuntu 20.04.1 LTS

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):

ISPConfig

1 Like

This isn't a very recent release, it's two+ years old.

How did you install certbot?

2 Likes

It was the script for installing ISPConfig as hosting panel

Did you upgrade python on your server, by any chance?

Googling this error points to a mismatch between python and its packages.

3 Likes

Yeah I upgrade it to python 3.9

1 Like

That's probably it.

2 Likes

Ubuntu supports snapd
Please uninstall the apt version of certbot and then follow these instructions:
Certbot Instructions | Certbot (eff.org)

3 Likes

It probably came with ispconfig and it looks like it's installed via pip. Maybe updating the pip packages will solve this issue, bit it could just as well break ispconfig entirely.

1 Like

If ISPConfig installed Certbot in a virtual environment specific for use by ISPConfig, it's also ISPConfigs responsibility to have a sane and valid working environment for Certbot.

However, from the log it seems Certbot was installed globally (/usr/bin/certbot) and also the josepy dependency seems to be system wide installed. I'm not sure how you determined Certbot was installed using pip?

2 Likes

I assumed it was and I didn't trust ispconfig to do it properly.

1 Like

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