Dear Community,
I recently upgraded to aiida-core v2. The installation went ahead without issues and I can access all of my old data and run processes with no problems (thus far). However, when I came to run calculations on my local HPC cluster I find that AiIDA cannot connect to the system via ssh. I tested the computer node (through verdi computer test) and found the following (with some personal information omitted for obvious reasons):
Opening connection... Error: Error connecting to <hostname> through SSH: [SshTransport] Private key file is encrypted, connect_args were: {'username': <username>, 'port': 22, 'look_for_keys': True, 'key_filename': <path_to_private_key>, 'timeout': 60, 'allow_agent': True, 'proxy_command': '', 'compress': True, 'gss_auth': False, 'gss_kex': False, 'gss_deleg_creds': False, 'gss_host': <hostname>}
[FAILED]: Error while trying to connect to the computer
The traceback from which is:
Full traceback:
Traceback (most recent call last):
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/aiida/cmdline/commands/cmd_computer.py", line 478, in computer_test
with transport:
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/aiida/transports/transport.py", line 133, in __enter__
self.open()
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/aiida/transports/plugins/ssh.py", line 522, in open
self._client.connect(self._machine, **connection_arguments)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/client.py", line 435, in connect
self._auth(
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/client.py", line 766, in _auth
raise saved_exception
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/client.py", line 736, in _auth
key = self._key_from_filepath(
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/client.py", line 588, in _key_from_filepath
key = klass.from_private_key_file(key_path, password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/pkey.py", line 249, in from_private_key_file
key = cls(filename=filename, password=password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/rsakey.py", line 64, in __init__
self._from_private_key_file(filename, password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/rsakey.py", line 194, in _from_private_key_file
data = self._read_private_key_file("RSA", filename, password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/pkey.py", line 322, in _read_private_key_file
data = self._read_private_key(tag, f, password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/pkey.py", line 348, in _read_private_key
data = self._read_private_key_pem(lines, end, password)
File "/home/hyphenater/envs/aiida-v2/lib/python3.8/site-packages/paramiko/pkey.py", line 400, in _read_private_key_pem
raise PasswordRequiredException("Private key file is encrypted")
paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted
Warning: 1 out of 0 tests failed
For the national facilities that I also use, this same test works without issue - as they did before the upgrade. After making sure that there wasn't a problem with my private key, I checked Paramiko itself and was able to re-create the issue by simply trying to start an ssh client session with the local cluster in IPython:
In [1]: from paramiko.client import SSHClient
In [2]: client = SSHClient()
In [3]: SSH_USER = <username>
...: SSH_HOST = <hostname>
...: SSH_PORT = 22
...: SSH_KEY = <path_to_key_file>
...: SSH_KEY_PASSWORD = ""
In [4]: client.load_system_host_keys()
...: client.connect(SSH_HOST, port=SSH_PORT, username=SSH_USER,look_for_keys=True,key_filename=SSH_KEY,passphrase=SSH_KEY_PASSWORD)
For the national facilities, this executes with no errors. For my local cluster I get different errors depending on whether the passphrase is included explicitly or not (note that the key is password-less, so this shouldn't make a difference). With the passphrase variable ommitted, the error is the same as before:(paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted)
However, if the passphrase variable is included in the command, I get this instead (after a long traceback):
ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).'
Again, this works both with and without the passphrase when connecting to the national facilities. I also tested previous versions of Paramiko and found that only v2.8 of Paramiko works with our local cluster - anything newer reproduces the same problem.
What I would like to know is whether aiida-core v2 (2.0.1 in this case) would work at all with an older version of Paramiko, or whether there is some other potential fix that I'm missing here.
All the best and thanks in advance
-Peter