You are not logged in.

#1 2020-03-19 09:15:31

aeons
Member
Registered: 2020-03-19
Posts: 3

[SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

I have a fresh Arch install. I have seen this problem with several go programs (AWS terraform provider, kubectl).

The error message looks something like this:

Unable to connect to the server: dial tcp: lookup <kubernetes domain> on [::1]:53: dial udp [::1]:53: socket: address family not supported by protocol

In attempting to resolve this, I have tried disabling IPv6 following the Wiki page. Before I did that, the error message did not say `address family not supported`.

In any case, there is nothing listening on `[::1]:53`, since IPv6 is disabled.

I'm not sure how to proceed here.

Last edited by aeons (2020-03-19 09:20:16)

Offline

#2 2020-03-19 09:21:15

aeons
Member
Registered: 2020-03-19
Posts: 3

Re: [SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

After correctly editing `/etc/sysctl.d/40-ipv6.conf` as mentioned in the wiki, and restarting the machine, not just `sysctl`, it seems to work.

However, I'm not sure what to do if I wanted to use IPv6 as well.

Offline

#3 2020-03-25 13:53:57

Slow
Member
Registered: 2020-03-25
Posts: 1

Re: [SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

Hi. How you fixed it? I have the exact same problem on fresh Arch installation.
My /etc/sysctl.d/40-ipv6.conf:

 
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.enp34s0.disable_ipv6 = 1
net.ipv6.conf.wlo1.disable_ipv6 = 1
net.ipv6.conf.wlp33s0.disable_ipv6 = 1

I turned off ipv6 like this:

 efibootmgr --disk /dev/nvme0n1 --part 1 --create --label "Arch Linux" --loader /vmlinuz-linux --unicode 'root=PARTUUID=3434618c-5bea-904d-a5c6-e17068e9eff7 rw initrd=/amd-ucode.img initrd=\initramfs-linux.img ipv6.disable=1' --verbose

result of ip addr show:

 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 30:9c:23:e3:70:7f brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global enp34s0
       valid_lft forever preferred_lft forever
3: wlo1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 48:89:e7:34:a8:96 brd ff:ff:ff:ff:ff:ff
    altname wlp33s0

and rest of config files looks like this:

$ cat /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1	localhost
127.0.1.1	hostName

$ cat /etc/resolv.conf 
# Resolver configuration file.
# See resolv.conf(5) for details.
8.8.8.8

however when I'm trying to use kubectl I'm stil getting error like this:

$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 
Unable to connect to the server: dial tcp: lookup raw.githubusercontent.com on [::1]:53: dial udp [::1]:53: socket: address family not supported by protocol

Offline

#4 2020-03-25 15:08:43

aeons
Member
Registered: 2020-03-19
Posts: 3

Re: [SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

Those two steps + a reboot was what worked for me.

Offline

#5 2020-10-12 08:00:38

nineinchnick
Member
From: Bialystok, Poland
Registered: 2010-11-14
Posts: 3

Re: [SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

Hi, I had the same issue today. Tried disabling IPv6 but it didn't help (with a reboot) but I also noticed that `systemd-resolved` was not listening on `::1` when IPv6 _was_ enabled.

Linking the stub `resolv.conf` helped:

# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

It's described as recommended here: https://wiki.archlinux.org/index.php/Sy … solved#DNS

Offline

#6 2023-09-16 21:15:03

mosh
Member
Registered: 2007-05-06
Posts: 12

Re: [SOLVED] Go programs fail by attempting to use non-existing IPv6 DNS

Thanks man, I love you.
IPv6 is disabled in kernel and sysctl and still golang looks for IPv6. Took me 3 hours of googling until I found your answer.

Offline

Board footer

Powered by FluxBB