zerotier / zerotier-systemd-manager

Manages systemd per-interface DNS resolution for zeronsd
https://zerotier.com
BSD 3-Clause "New" or "Revised" License
60 stars 7 forks source link

Doesn't work if /etc/hosts isn't properly populated #27

Closed ilyasdc closed 3 months ago

ilyasdc commented 3 months ago

Hello,

I spent much more time I care to admit for understanding why your program wasn't working. I got such elusive (at least for me) errors on archlinux:

Mar 18 22:04:11 envyx360 systemd[1]: Starting Update zerotier per-interface DNS settings...
Mar 18 22:04:11 envyx360 zerotier-systemd-manager[715152]: Get "http://localhost:9993/network": dial tcp: lookup localhost on 192.168.1.1:53: no such host
Mar 18 22:04:11 envyx360 systemd[1]: zerotier-systemd-manager.service: Main process exited, code=exited, status=1/FAILURE
Mar 18 22:04:11 envyx360 systemd[1]: zerotier-systemd-manager.service: Failed with result 'exit-code'.
Mar 18 22:04:11 envyx360 systemd[1]: Failed to start Update zerotier per-interface DNS settings.

In the end the archlinux wiki (as always) pointed me in the right direction (https://wiki.archlinux.org/title/Network_configuration#localhost_is_resolved_over_the_network) that I had to populate /etc/hosts

nss-myhostname(8) (an NSS module provided by systemd and enabled by default in /etc/nsswitch.conf) provides localhost and the local hostname resolution to an IP address. Some software may, however, still instead read /etc/hosts directly; see [4] [5] for examples.

Note that it is the first time I need to fix this ( I could access localhost from within a browser without problem).

laduke commented 3 months ago

Sorry about that. Looks like some battle between go, glibc, arch, etc...

https://bugs.archlinux.org/task/56684

I wouldn't be surprised if all go programs that connect to localhost are affected. Please add something to the README if you think it would help.

ilyasdc commented 3 months ago

Done, see #28

laduke commented 3 months ago

thanks!