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

"[Errno 8] nodename nor servname provided, or not known" error when running gefyra up #92

Closed
cappuc opened this issue May 31, 2022 · 16 comments · Fixed by #96
Closed

"[Errno 8] nodename nor servname provided, or not known" error when running gefyra up #92

cappuc opened this issue May 31, 2022 · 16 comments · Fixed by #96
Labels
bug 🐛 Something isn't working

Comments

@cappuc
Copy link
Contributor

cappuc commented May 31, 2022

Hi,
I'm following the instruction to try gefyra but when I run gefyra up, it fails with this error.

Here is the full log for gefyra --debug up:

[INFO] There was no --endpoint argument provided. Connecting to a local Kubernetes node.
[INFO] Installing Gefyra Operator
[DEBUG] Creating Docker network
[CRITICAL] There was an error running Gefyra: [Errno 8] nodename nor servname provided, or not known

I've already some docker networks so maybe there is some conflict with existing networks:

docker network ls

NETWORK ID     NAME                     DRIVER    SCOPE
5c4c368c011f   bridge                   bridge    local
17e511573627   host                     host      local
914dfb2d33b0   compose-local_default    bridge    local
5dbca0682625   none                     null      local
c16bf9515da4   takeout                  bridge    local

System info:
OS: macOs Big Sur 11.6
Docker desktop: 4.8.2 (engine: 20.10.14)
Gefyra installed from homebrew

@SteinRobert SteinRobert added the triage To be investigated label May 31, 2022
@SteinRobert
Copy link
Contributor

Hey @cappuc - thank you very much for reporting the issue, you're amazing! 🥇
We really do appreciate the report.

I'm using gefyra on OSX as well - however I'm running on Monterey. This could be the reason why I wasn't able to reproduce the issue.

Anyways, I dug into the code and suspect that this line is responsible for the error:
https://github.com/gefyrahq/gefyra/blob/main/client/gefyra/local/networking.py#L81

At that point we're trying to find out some things about your local docker network. I suspect that - for some reason we're not able to resolve your hostname. At least this would probably result in the same error message.

Note for me - reproduce the message with:

socket.getaddrinfo(socket.gethostname() + "random", None)

Do you happen to have a Python interpreter installed on your machine?
If yes could you please run following lines in python3 and post the output here?

import socket
socket.getaddrinfo(socket.gethostname(), None)

If you feel like there are any sensible information about your network in the output - feel free to edit the IP addresses.

@cappuc
Copy link
Contributor Author

cappuc commented Jun 1, 2022

Hey @SteinRobert,

The error is from the socket.getaddrinfo() function call:

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostname()
'MacBook-Pro-di-Fabio.local'
>>> socket.getaddrinfo(socket.gethostname(), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

@SteinRobert
Copy link
Contributor

Hey @cappuc - this does help us a lot! Thank you very much. Now we just need to figure out how to address the issue :D
I'll keep you posted on the fix here! 🚀

@cappuc
Copy link
Contributor Author

cappuc commented Jun 1, 2022

Thank you!

If you need some other testing, let me know

@SteinRobert SteinRobert added bug 🐛 Something isn't working and removed triage To be investigated labels Jun 1, 2022
@SteinRobert
Copy link
Contributor

@cappuc just looked into this - could you please try the following in your python interpreter?

import socket
socket.gethostbyname(socket.gethostname()
socket.getaddrinfo(socket.gethostbyname(socket.gethostname()), None)

Thank you!

@cappuc
Copy link
Contributor Author

cappuc commented Jun 3, 2022

I have the same error calling gethostbyname

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname(socket.gethostname())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

@cappuc
Copy link
Contributor Author

cappuc commented Jun 3, 2022

I don't know if this is the result you need but with localhost it works:

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname('localhost')
'127.0.0.1'
>>> socket.getaddrinfo('localhost', None)
[
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('127.0.0.1', 0)), 
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('::1', 0, 0, 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 0, 0, 0))
]
>>>

@SteinRobert
Copy link
Contributor

I suspect it has something to do with the .local at the end of your hostname.
Could you please try the following?

import socket
socket.getaddrinfo(socket.gethostname().replace(".local", ""), None)

Thank you very much for your patience!

@cappuc
Copy link
Contributor Author

cappuc commented Jun 3, 2022

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo(socket.gethostname().replace(".local", ""), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

@cappuc
Copy link
Contributor Author

cappuc commented Jun 3, 2022

I found a temporary solution from stackoverflow.

If I enable file sharing it works (but it stop working if I disable it):

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo(socket.gethostname(), None)
[
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('127.0.0.1', 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 0, 0, 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('::1', 0, 0, 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('fe80::1', 0, 0, 1)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('fe80::1', 0, 0, 1)), 
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 0)), 
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('192.168.1.99', 0)), 
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('192.168.1.99', 0)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('fe80::b:ffa7:475b:6f9e', 0, 0, 6)), 
(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('fe80::b:ffa7:475b:6f9e', 0, 0, 6))
]

@SteinRobert
Copy link
Contributor

SteinRobert commented Jun 3, 2022

Oh well, thank you. I was somewhat hoping that the .local at the end of your hostname is the issue. So what we're trying to do here is to determine an available class c network. For this we try to retrieve the address information of your host machine. For some reason your hostname does not resolve which causes the error.
Working with localhost does not really help, since we're looking for other network information.
It also seems other people have experienced these issues:

https://bugs.python.org/issue29705
https://bugs.python.org/issue35164

Trying to figure out if this is a Python thing or it something on a lower level could you tell me what this command prints?

nslookup $(hostname)

€dit: Thanks! This is interesting - file sharing is disabled on my Mac and it still works. 🤔 Well this seems to have something to do with the OS settings and version then...

€dit2: Just wondering - the time of your interpreter seems to be always the same. I guess it does not have something to do with this issue - was just wondering if you have any special OS settings or restrictions in place.

@cappuc
Copy link
Contributor Author

cappuc commented Jun 3, 2022

It seems to be a macOs issue but maybe they fixed it in monterey.

  • nslookup $(hostname) dosen't resolve hostname with or without sharing enabled
  • ping $(hostname) works only with sharing enabled

€dit2: Just wondering - the time of your interpreter seems to be always the same. I guess it does not have something to do with this issue - was just wondering if you have any special OS settings or restrictions in place.

I think that Python 3.9.13 (main, May 24 2022, 21:28:44) its the time when the python executable has been built

@SteinRobert
Copy link
Contributor

Thank you. I just found another method which might work. What does the following return for you?

import socket
socket.gethostbyname_ex(socket.gethostname())

@cappuc
Copy link
Contributor Author

cappuc commented Jun 6, 2022

Same error:

Python 3.9.13 (main, May 24 2022, 21:28:44)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname_ex(socket.gethostname())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

@Schille
Copy link
Collaborator

Schille commented Jun 8, 2022

Hi @cappuc thanks a bunch for your patience and support.
I think I resolved this issue by removing the code that was causing the troubles entirely. =)
There is another solution in place from version 0.8.1 to determine a free IP address pool (without using Python).

I would be super happy if you may confirm it working and report the current state on your machine.

@Schille Schille reopened this Jun 8, 2022
@cappuc
Copy link
Contributor Author

cappuc commented Jun 9, 2022

Hi @Schille,
With 0.8.1 it works without enabling file sharing.

Thank you!

@Schille Schille closed this as completed Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants