[BUG] `OSError: Cannot locate OpenSSL libcrypto` on MacOS + M1 Mac
See original GitHub issueDescription
Hi all, I just got a new Macbook Pro M1 running MacOS Monteray (12.0.1) and I’m trying to set it up using my Salt states. Unfortunately, I cannot get Salt to run after installing the latest version in Homebrew.
❯ sudo salt-call
Password:
Traceback (most recent call last):
File "/opt/homebrew/bin/salt-call", line 8, in <module>
sys.exit(salt_call())
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/scripts.py", line 426, in salt_call
import salt.cli.call
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/cli/call.py", line 3, in <module>
import salt.cli.caller
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/cli/caller.py", line 15, in <module>
import salt.minion
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/minion.py", line 24, in <module>
import salt.crypt
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/crypt.py", line 31, in <module>
import salt.utils.rsax931
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/utils/rsax931.py", line 142, in <module>
libcrypto = _init_libcrypto()
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/utils/rsax931.py", line 95, in _init_libcrypto
libcrypto = _load_libcrypto()
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/utils/rsax931.py", line 88, in _load_libcrypto
return cdll.LoadLibrary(_find_libcrypto())
File "/opt/homebrew/Cellar/salt/3004/libexec/lib/python3.10/site-packages/salt/utils/rsax931.py", line 80, in _find_libcrypto
raise OSError("Cannot locate OpenSSL libcrypto")
OSError: Cannot locate OpenSSL libcrypto
I have done a fair amount of Googling and looking at the issues in this repo and I’m seeing the following:
I have tried some of the fixes outlined here, like symlinking the dylibs to various places and making sure I have the latest version of cryptography installed, but alas, this still isn’t working.
Setup
Use an M1 Mac on 12.0.1 and brew install saltstack
Steps to Reproduce the behavior
-
brew install saltstack -
sudo salt-call
Expected behavior
I think salt-call without any arguments outputs the usage info?
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)❯ salt --versions-report
Salt Version:
Salt: 3004
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.0
docker-py: Not Installed
gitdb: 4.0.5
gitpython: 3.1.12
Jinja2: 2.11.3
libgit2: 1.3.0
M2Crypto: Not Installed
Mako: 1.1.4
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 3.11.0
pycryptodome: 3.9.8
pygit2: 1.7.0
Python: 3.10.0 (default, Oct 22 2021, 13:24:07) [Clang 13.0.0 (clang-1300.0.29.3)]
python-gnupg: 0.4.4
PyYAML: 5.4.1
PyZMQ: 21.0.2
smmap: 3.0.2
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: darwin 21.1.0
locale: utf-8
machine: arm64
release: 21.1.0
system: Darwin
version: 12.0.1 arm64
Additional context Thanks Salt team, y’all are doing the best you can and I very much appreciate it! I hope your holidays are safe and happy!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Related StackOverflow Question
Homebrew on M1 installs in
/opt/homebrew. https://github.com/saltstack/salt/blob/master/salt/utils/rsax931.py#L35 assumes that the prefix is/usr/local.You can change the prefix for now using
env HOMEBREW_PREFIX=/opt/homebrewahead of your Salt command.Ideally, the code will check both paths, since M1 machines can still use
/usr/localif they run Homebrew under Rosetta.That said, I now get
TypeError: cannot pickle '_thread._local' objectwhich I need to look into. Looks like that issue is: https://github.com/saltstack/salt/issues/57742I would 👍 the documentation and I would also say that it maybe makes sense to be able to handle this without the env var needing to be set. If Salt can detect that it’s installed in
/opt/Homebrew, it might be safe to add that to the path search for these libraries.