Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspbian bookworm: undefined symbol EVP_idea_cbc #10881

Closed
tkundrat opened this issue Apr 24, 2024 · 12 comments
Closed

Raspbian bookworm: undefined symbol EVP_idea_cbc #10881

tkundrat opened this issue Apr 24, 2024 · 12 comments
Labels
waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

Comments

@tkundrat
Copy link

  • Versions of Python, cryptography, cffi, pip, and setuptools
    you're using
    • cryptography: 42.0.5
    • cffi: 1.16.0
    • pip: 24.0
    • setuptools: 69.5.1
  • How you installed cryptography
    • pip3 install homeassistant (version 2024.4.4), which has a dependency for cryptography==42.0.5
  • Clear steps for reproducing your bug
    • Create venv with Python 3.12.2 (compiled locally from source as raspbian bookworm only ships 3.11.6)
    • source bin/activate inside the venv directory
    • pip3 install homeassistant
    • run hass inside the venv
    • Traceback:
Traceback (most recent call last):
  File "/srv/homeassistant/bin/hass", line 8, in <module>                                                                                                                
    sys.exit(main())                                                                
             ^^^^^^                                                                                                                                                      
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 174, in main
    args = get_arguments()                                                                                                                                               
           ^^^^^^^^^^^^^^^                                                          
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 82, in get_arguments 
    from . import config as config_util
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config.py", line 27, in <module>
    from . import auth
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/auth/__init__.py", line 13, in <module>
    import jwt
  File "/srv/homeassistant/lib/python3.12/site-packages/jwt/__init__.py", line 1, in <module>
    from .api_jwk import PyJWK, PyJWKSet
  File "/srv/homeassistant/lib/python3.12/site-packages/jwt/api_jwk.py", line 7, in <module>
    from .algorithms import get_default_algorithms, has_crypto, requires_cryptography
  File "/srv/homeassistant/lib/python3.12/site-packages/jwt/algorithms.py", line 12, in <module>
    from .utils import (
  File "/srv/homeassistant/lib/python3.12/site-packages/jwt/utils.py", line 7, in <module>
    from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
  File "/srv/homeassistant/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py", line 11, in <module>
    from cryptography.hazmat._oid import ObjectIdentifier
  File "/srv/homeassistant/lib/python3.12/site-packages/cryptography/hazmat/_oid.py", line 7, in <module>
    from cryptography.hazmat.bindings._rust import (
ImportError: /srv/homeassistant/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust.cpython-312-arm-linux-gnueabihf.so: undefined symbol: EVP_idea_cbc, version OPENSSL_3.0.0

I'm using OpenSSL 3.0.11 19 Sep 2023 (Library: OpenSSL 3.0.11 19 Sep 2023).
Rust compiler:

stable-arm-unknown-linux-gnueabihf (default)
rustc 1.77.2 (25ef9e3d8 2024-04-09)

OS: Raspbian GNU/Linux 12 (bookworm) aarch64

It seems the mentioned .so file does not contain the symbol (I checked with nm -gD), so maybe the wrong openssl is used? I just installed the official packaged version via sudo apt install openssl.

@alex
Copy link
Member

alex commented Apr 24, 2024

When you installed cryptography, where did the installation come from -- https://www.piwheels.org/ or did you build it yourself?

@alex alex added the waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply. label Apr 24, 2024
@tkundrat
Copy link
Author

cryptography was compiled during pip install

@alex
Copy link
Member

alex commented Apr 24, 2024

Hmm. Can you re-build cryptography with verbose logs and paste the output -- something like pip install -vvv cryptography --no-binary cryptography

@tkundrat
Copy link
Author

I rebuilt the package using pip3 install --force-reinstall --no-cache-dir cryptography -vvv cryptography --no-binary cryptography, the output I piped into this file:
verbose.log

@alex
Copy link
Member

alex commented Apr 24, 2024

Hmm, I'm a bit perplexed. I can see in the log that CRYPTOGRAPHY_OSSLCONF="OPENSSL_NO_IDEA" is being passed to our build, as expected. And we guard usage of IDEA with: #[cfg(not(CRYPTOGRAPHY_OSSLCONF = "OPENSSL_NO_IDEA"))]

So I'm not sure why it would be that it's trying to link this symbol.

@tkundrat
Copy link
Author

tkundrat commented Apr 24, 2024

On my currently running Home Assistant installation, I'm running the same cryptography version with Python 3.11.6 in a venv. There everything is working fine. The difference is only the cffi and setuptools version, could there be an issue?
I set up a new venv for this issue for testing under /home/pi/test-venv/ , but I did the same steps as for the actual installation under /srv/homeassistant/ , so there should not be an issue.
Is there something else I can try?

@alex
Copy link
Member

alex commented Apr 24, 2024 via email

@alex
Copy link
Member

alex commented Apr 24, 2024

If you install from git (pip install git+https://github.com/pyca/cryptography) does this problem still occur?

@tkundrat
Copy link
Author

tkundrat commented Apr 25, 2024

There are some version constraints I had to violate:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency confl
icts.                                                                                                                                                                    
pyopenssl 24.1.0 requires cryptography<43,>=41.0.5, but you have cryptography 43.0.0.dev1 which is incompatible.                                                         
homeassistant 2024.4.4 requires cryptography==42.0.5, but you have cryptography 43.0.0.dev1 which is incompatible.

I now ran hass --skip-pip-packages cryptography, so cryptography 42.0.5 does not get installed automatically again, we also get a warning:

2024-04-25 11:18:45.845 WARNING (MainThread) [homeassistant.bootstrap] Skipping pip installation of required modules. This may cause issues

Home Assistant begins to start, but I get the error

ImportError: libmmal_core.so.0: cannot open shared object file: No such file or directory

Don't know if that is related to this issue.
But otherwise it seems to work, Home Assistant itself is starting up.

@alex
Copy link
Member

alex commented Apr 25, 2024 via email

Copy link

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

@github-actions github-actions bot added the Stale label Apr 29, 2024
@tkundrat
Copy link
Author

tkundrat commented May 1, 2024

I did not have any new idea to test. So I rebooted my pi again today and tried rebuilding the package as before inside my test-venv with pip3 install --force-reinstall --no-cache-dir cryptography -no-binary cryptography. Home Assistant now starts successfully, with the same error as with the 43.0.0 git version (libmmal_core.so.0 not found), but I don't think it's related to this.

@github-actions github-actions bot removed the Stale label May 2, 2024
@tkundrat tkundrat closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.
Development

No branches or pull requests

2 participants