0260203 14:32:28.218 : INFO : Logging into ‘slx081vm:22’ as ‘saimadm’.
20260203 14:32:33.227 : FAIL : gaierror: [Errno -2] Name or service not known
20260203 14:32:33.229 : DEBUG :
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/SSHLibrary/library.py”, line 1007, in login
return self._login(self.current.login, username, password, is_truthy(allow_agent),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/SSHLibrary/library.py”, line 1087, in _login
login_output = login_method(username, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/SSHLibrary/abstractclient.py”, line 208, in login
self._login(username, password, allow_agent, look_for_keys, proxy_cmd, read_config,
File “/usr/local/lib/python3.11/site-packages/SSHLibrary/pythonclient.py”, line 183, in _login
self.client.connect(self.config.host, self.config.port, username,
File “/usr/local/lib/python3.11/site-packages/paramiko/client.py”, line 377, in connect
to_try = list(self._families_and_addresses(hostname, port))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/paramiko/client.py”, line 202, in _families_and_addresses
addrinfos = socket.getaddrinfo(
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/socket.py”, line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known
When a try on a prompt, i have
root@robot:/home/t0042275.ZDFRES/minds-insight-auto-tests# ssh slx081vm:22
ssh: Could not resolve hostname slx081vm:22: Name or service not known
root@robot:/home/t00XXX.ZDFRES#
root@robot:/home/t00XXX.ZDFRES#
root@robot:/home/t00XXX.ZDFRES#
root@robot:/home/t00XXX.ZDFRES/minds-insight-auto-tests# ssh slx081vm -p 22
Warning: Permanently added ‘IPXXX’ (ED25519) to the list of known hosts.
Warning: Permanently added ‘IPYYY’ (ED25519) to the list of known hosts.
Warning: Permanently added ‘IPZZZ’ (ED25519) to the list of known hosts.
(saimadm@IPZZZ) Password:
Hello Helio,
Thank you, I read the documentation and indeed I am passing my machine name to open connection. Port 22 isn’t necessary; it was just an example.
The problem is the syntax: as I show in the prompt query, my system doesn’t accept the machinename:22 syntax.
It’s necessary to use the command `ssh machinename -p 22`, which SSHLIBRARY doesn’t do.
From this section of your log, you can see SSHLibrary is not actually calling the ssh command at all, it’s using the python socket library to make the connection:
File “/usr/local/lib/python3.11/socket.py”, line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I guess my first question is are both these log output’s you showed from the same machine?
My reading is that it seems to be SSHLibrary was not able to resolve the hostname slx081vm, well more accurately the python socket module via the paramiko module, via SSHLibrary was not able to resolve the hostname.
I would suggest as a troubleshooting step to try the FQDN hostname for slx081vm, i.e. something likeslx081vm.yourdomain.com or otherwise try using the ip address for slx081vm this will allow you to confirm is SSHLibrary is able to connect to the host, and then you can work on the name resolution issue unqualified hostname if you really need to use that.
socket.gaierror: [Errno -2] Name or service not known
and what triggers that:
socket.getaddrinfo(
and root cauase:
slx081vm:22
So, from this, one can deduct that the port you provided contains the port and that string goes into getaddrinfo() which tries to resolve the name into ip address. However, port is not part of the information that can be used to resolv name to ip..
I’ve not used sshlibrary myself and since you didn’t show how you try to connect (eg, the robot framework side that triggers this issue), only thing i can assume is you are not passing the `port` kwarg and just postfixing the port number to the hostname which is incorrect. This works because ssh client itself knows how to deal hostname and port and ….
And i would assume that sshlibrary/paramiko can actually use ssh client’s config file (typically ~/.ssh/config). As your hostname is slx081vm, unless you have this mapped in /etc/hosts or your dns resolver automatically adds the domain part, removing the port from hostname most likely wont work either. It very well could be that the hostname “slx081vm” is mentioned in the ssh’s config file ..
OK, now I see your confusion.
You must use the options for the ssh command and they don’t match the Python or SSHLibrary syntax.
Remember that Robot Framework libraries are a easy way to use operating system commands or Python functions.
It’s complicated. I’m in a Docker container, inside a virtual machine, and I’m trying to contact another virtual machine… I don’t have access to the SSH configuration files… and more importantly, I can’t modify them.
To answer the questions, using the IP address doesn’t work either; pings don’t return any response… it’s too difficult.
The only thing that works is the SSH call `slx081vm` (without port 22), which seems to be bouncing around quite a bit…
In short, all this leads me to believe I should first look at my network administrators.
Is the other machine your trying to connect to another docker container by any chance? because Networking between docker containers can be a bit tricky
if it’s another VM that not a docker container, then is it on the same host or virtual machine cluster? it could be an issue with name resolution in the virtual machine environment.
if it’s another VM that not a docker container, and on a different host or virtual machine cluster, then it could come down to your organisations DNS configuration.
Also things to consider:
is it only IPv4 or is IPv6 in play as well?
is zeroconf/mDNS in play (more common on IPv6 Networks) though usually this makes name resolution easier