You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: x509_v2 module can't be used with salt-ssh #68625
minion2:
----------
_error:
The command resulted in a non-zero exit code
parsed:
None
retcode:
255
stderr:
'x509' __virtual__ returned False: Superseded, using x509_v2
stdout:
The error message is a red herring, it's shown because your configuration successfully disables the deprecated x509 modules, but the x509_v2 execution module crashes when it's loaded.
The crash is caused by a missing cryptography in the system Python:
2026-01-13 09:56:35,048 [salt.loader.lazy :917 ][DEBUG ][39996] Failed to import utils x509:Traceback (most recent call last): File "/tmp/.thin_dir/pyall/salt/loader/lazy.py", line 902, in _load_module self.run(spec.loader.exec_module, mod) File "/tmp/.thin_dir/pyall/salt/loader/lazy.py", line 1365, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.thin_dir/pyall/salt/loader/lazy.py", line 1380, in _run_as ret = _func_or_method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/tmp/.thin_dir/running_data/var/cache/salt/minion/extmods/utils/x509.py", line 12, in <module> import cryptographyModuleNotFoundError: No module named 'cryptography'
It seems you are distributing a custom x509 utils module (File "/tmp/.thin_dir/running_data/var/cache/salt/minion/extmods/utils/x509.py") and x509_v2 execution module (the one in Salt core imports salt.utils.x509 directly while guarding against an ImportError):
Does the debug log show that x509_v2's __virtual__ has been executed? It crashed previously, but in vanilla Salt, it shouldn't. I'm unsure how Salt selects the message to display here.
make it working
Awesome!
Shouldn't it be installed in the self contained python provided by onedir?
It is installed inside the onedir, but salt-ssh precedes onedir and hand-crafts hard required pure-Python libraries from its Python environment (the onedir installed on the master) into a so-called "thin archive" that it transfers over to the remote host. cryptography is not pure Python (most of its cryptography is done in Rust), hence cannot generally be transferred that way. 3008 salt-ssh will provide a way to optionally pull a matching onedir Salt to the remote host in place of the previous method, similar to heist-salt and the way you're expecting.
Note that most library dependencies for any module that is executed on the target need to be installed into the remote host's system Python environment, this is not particular to cryptography.
Does the debug log show that x509_v2's virtual has been executed? It crashed previously, but in vanilla Salt, it shouldn't. I'm unsure how Salt selects the message to display here.
Ok, but it should be explicit in the logs because here it's quite cryptic 😅
Agreed. If the __virtual__ gets executed as expected, the message about missing cryptography is received by the loader, so it would need to be fixed there, maybe by displaying all __virtual__() == False messages instead of just the last one tried.
Activity
lkubb commentedon Jan 26, 2026
The error message is a red herring, it's shown because your configuration successfully disables the deprecated
x509modules, but thex509_v2execution module crashes when it's loaded.The crash is caused by a missing
cryptographyin the system Python:It seems you are distributing a custom
x509utils module (File "/tmp/.thin_dir/running_data/var/cache/salt/minion/extmods/utils/x509.py") andx509_v2execution module (the one in Salt core importssalt.utils.x509directly while guarding against an ImportError):salt/salt/modules/x509_v2.py
Lines 178 to 186 in 62a7bb0
baby-gnu commentedon Jan 28, 2026
I redid my test in a clean environment with 2 freshly installed Bookworm:
salt-sshon one machinesalt-ssh minion1 test.ping→ TrueThen the command fails as before:
I finally make it working by installing the
python3-cryptographyon the Debian OS:Shouldn't it be installed in the self contained python provided by onedir?
lkubb commentedon Jan 28, 2026
Does the debug log show that x509_v2's
__virtual__has been executed? It crashed previously, but in vanilla Salt, it shouldn't. I'm unsure how Salt selects the message to display here.Awesome!
It is installed inside the onedir, but
salt-sshprecedesonedirand hand-crafts hard required pure-Python libraries from its Python environment (the onedir installed on the master) into a so-called "thin archive" that it transfers over to the remote host.cryptographyis not pure Python (most of its cryptography is done in Rust), hence cannot generally be transferred that way. 3008 salt-ssh will provide a way to optionally pull a matching onedir Salt to the remote host in place of the previous method, similar toheist-saltand the way you're expecting.Note that most library dependencies for any module that is executed on the target need to be installed into the remote host's system Python environment, this is not particular to
cryptography.baby-gnu commentedon Jan 28, 2026
I modified the code to add some
log.debug:So, it's
__virtual__is executed.Ok, but it should be explicit in the logs because here it's quite cryptic 😅
lkubb commentedon Jan 28, 2026
Agreed. If the
__virtual__gets executed as expected, the message about missingcryptographyis received by the loader, so it would need to be fixed there, maybe by displaying all__virtual__() == Falsemessages instead of just the last one tried.Surface every __virtual__ False reason on virtualname collisions
Merge pull request #69359 from dwoz/fix/issue-68625
Fix loader race that poisoned OS-specific virtualnames
Fix loader race that poisoned OS-specific virtualnames