qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.

Home Page:https://hub.docker.com/r/qmcgaw/gluetun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Error while connecting

needsupport opened this issue Β· comments

Is this urgent?

None

Host OS

Ubuntu

CPU arch

x86_64

VPN service provider

Custom

What are you using to run the container

docker run

What is the version of Gluetun

latest

What's the problem πŸ€”

I can not connect. wire guard config is fine. I tested it

Share your logs (at least 10 lines)

|   └── Wireguard settings:
|       β”œβ”€β”€ Private key: 
|       β”œβ”€β”€ Interface addresses:
|       |   └── 172.17.80.199/32
|       β”œβ”€β”€ Allowed IPs:
|       |   β”œβ”€β”€ 0.0.0.0/0
|       |   └── ::/0
|       └── Network interface: tun1
|           └── MTU: 1400
β”œβ”€β”€ DNS settings:
|   β”œβ”€β”€ Keep existing nameserver(s): no
|   β”œβ”€β”€ DNS server address to use: 
|   └── DNS over TLS settings:
|       β”œβ”€β”€ Enabled: yes
|       β”œβ”€β”€ Update period: every 24h0m0s
|       β”œβ”€β”€ Unbound settings:
|       |   β”œβ”€β”€ Authoritative servers:
|       |   |   └── cloudflare
|       |   β”œβ”€β”€ Caching: yes
|       |   β”œβ”€β”€ IPv6: no
|       |   β”œβ”€β”€ Verbosity level: 1
|       |   β”œβ”€β”€ Verbosity details level: 0
|       |   β”œβ”€β”€ Validation log level: 0
|       |   β”œβ”€β”€ System user: root
|       |   └── Allowed networks:
|       |       β”œβ”€β”€ 0.0.0.0/0
|       |       └── ::/0
|       └── DNS filtering settings:
|           β”œβ”€β”€ Block malicious: yes
|           β”œβ”€β”€ Block ads: no
|           β”œβ”€β”€ Block surveillance: no
|           └── Blocked IP networks:
|               β”œβ”€β”€ 127.0.0.1/8
|               β”œβ”€β”€ 10.0.0.0/8
|               β”œβ”€β”€ 172.16.0.0/12
|               β”œβ”€β”€ 192.168.0.0/16
|               β”œβ”€β”€ 169.254.0.0/16
|               β”œβ”€β”€ ::1/128
|               β”œβ”€β”€ fc00::/7
|               β”œβ”€β”€ fe80::/10
|               β”œβ”€β”€ ::ffff:127.0.0.1/104
|               β”œβ”€β”€ ::ffff:10.0.0.0/104
|               β”œβ”€β”€ ::ffff:169.254.0.0/112
|               β”œβ”€β”€ ::ffff:172.16.0.0/108
|               └── ::ffff:192.168.0.0/112
β”œβ”€β”€ Firewall settings:
|   β”œβ”€β”€ Enabled: yes
|   └── VPN input ports:
|       └── XX
β”œβ”€β”€ Log settings:
|   └── Log level: info
β”œβ”€β”€ Health settings:
|   β”œβ”€β”€ Server listening address: 127.0.0.1:9999
|   β”œβ”€β”€ Target address: cloudflare.com:443
|   β”œβ”€β”€ Duration to wait after success: 5s
|   β”œβ”€β”€ Read header timeout: 100ms
|   β”œβ”€β”€ Read timeout: 500ms
|   └── VPN wait durations:
|       β”œβ”€β”€ Initial duration: 6s
|       └── Additional duration: 5s
β”œβ”€β”€ Shadowsocks server settings:
|   └── Enabled: no
β”œβ”€β”€ HTTP proxy settings:
|   └── Enabled: no
β”œβ”€β”€ Control server settings:
|   β”œβ”€β”€ Listening address: :8000
|   └── Logging: yes
β”œβ”€β”€ OS Alpine settings:
|   β”œβ”€β”€ Process UID: 1000
|   └── Process GID: 1000
β”œβ”€β”€ Public IP settings:
|   β”œβ”€β”€ Fetching: every 12h0m0s
|   β”œβ”€β”€ IP file path: /tmp/gluetun/ip
|   └── Public IP data API: ipinfo
└── Version settings:
    └── Enabled: yes
2024-04-29T19:51:34Z WARN DNS address is set to XX so the DNS over TLS (DoT) server will not be used. The default value changed to 127.0.0.1 so it uses the internal DoT serves. If the DoT server fails to start, the IPv4 address of the first plaintext DNS server corresponding to the first DoT provider chosen is used.
2024-04-29T19:51:34Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1, assigned IP 172.18.0.2 and family v4
2024-04-29T19:51:34Z INFO [routing] adding route for 0.0.0.0/0
2024-04-29T19:51:34Z INFO [firewall] setting allowed subnets...
2024-04-29T19:51:34Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1, assigned IP 172.18.0.2 and family v4
2024-04-29T19:51:34Z INFO TUN device is not available: open /dev/net/tun: no such file or directory; creating it...
2024-04-29T19:51:34Z INFO [dns] using plaintext DNS at address XX
2024-04-29T19:51:34Z INFO [http server] http server listening on [::]:8000
2024-04-29T19:51:34Z INFO [healthcheck] listening on 127.0.0.1:9999
panic: runtime error: index out of range [0] with length 0
goroutine 31 [running]:
github.com/qdm12/gluetun/internal/provider/custom.getWireguardConnection(...)
	github.com/qdm12/gluetun/internal/provider/custom/connection.go:60
github.com/qdm12/gluetun/internal/provider/custom.(*Provider).GetConnection(_, {{0xc000028021, 0x9}, {{0x0, 0xffff9859a204}, 0xc000010018}, {0x0, 0x0, 0x0}, {0x0, ...}, ...}, ...)
	github.com/qdm12/gluetun/internal/provider/custom/connection.go:24 +0x35a
github.com/qdm12/gluetun/internal/vpn.setupWireguard({_, _}, {_, _}, {_, _}, {_, _}, {{0xc000028021, 0x9}, ...}, ...)
	github.com/qdm12/gluetun/internal/vpn/wireguard.go:20 +0xbe
github.com/qdm12/gluetun/internal/vpn.(*Loop).Run(0xc0002f2840, {0x1226060, 0xc0001d8b40}, 0xc00053cd20?)
	github.com/qdm12/gluetun/internal/vpn/run.go:40 +0x4df
created by main._main in goroutine 50
	./main.go:443 +0x33d7

Share your configuration

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - VPN_ENDPOINT_IP=X
      - VPN_ENDPOINT_PORT=X
      - WIREGUARD_PUBLIC_KEY=X
      - WIREGUARD_PRIVATE_KEY=X
      - WIREGUARD_ADDRESSES=X
      - DNS_ADDRESS=X
      - FIREWALL_VPN_INPUT_PORTS=6X

@qdm12 is more or less the only maintainer of this project and works on it in his free time.
Please:

Is this urgent?

None

Host OS

Ubuntu

CPU arch

x86_64

VPN service provider

Custom

What are you using to run the container

docker run

What is the version of Gluetun

latest

What's the problem πŸ€”

I can not connect. wire guard config is fine. I tested it

Share your logs (at least 10 lines)

|   └── Wireguard settings:
|       β”œβ”€β”€ Private key: 
|       β”œβ”€β”€ Interface addresses:
|       |   └── 172.17.80.199/32
|       β”œβ”€β”€ Allowed IPs:
|       |   β”œβ”€β”€ 0.0.0.0/0
|       |   └── ::/0
|       └── Network interface: tun1
|           └── MTU: 1400
β”œβ”€β”€ DNS settings:
|   β”œβ”€β”€ Keep existing nameserver(s): no
|   β”œβ”€β”€ DNS server address to use: 
|   └── DNS over TLS settings:
|       β”œβ”€β”€ Enabled: yes
|       β”œβ”€β”€ Update period: every 24h0m0s
|       β”œβ”€β”€ Unbound settings:
|       |   β”œβ”€β”€ Authoritative servers:
|       |   |   └── cloudflare
|       |   β”œβ”€β”€ Caching: yes
|       |   β”œβ”€β”€ IPv6: no
|       |   β”œβ”€β”€ Verbosity level: 1
|       |   β”œβ”€β”€ Verbosity details level: 0
|       |   β”œβ”€β”€ Validation log level: 0
|       |   β”œβ”€β”€ System user: root
|       |   └── Allowed networks:
|       |       β”œβ”€β”€ 0.0.0.0/0
|       |       └── ::/0
|       └── DNS filtering settings:
|           β”œβ”€β”€ Block malicious: yes
|           β”œβ”€β”€ Block ads: no
|           β”œβ”€β”€ Block surveillance: no
|           └── Blocked IP networks:
|               β”œβ”€β”€ 127.0.0.1/8
|               β”œβ”€β”€ 10.0.0.0/8
|               β”œβ”€β”€ 172.16.0.0/12
|               β”œβ”€β”€ 192.168.0.0/16
|               β”œβ”€β”€ 169.254.0.0/16
|               β”œβ”€β”€ ::1/128
|               β”œβ”€β”€ fc00::/7
|               β”œβ”€β”€ fe80::/10
|               β”œβ”€β”€ ::ffff:127.0.0.1/104
|               β”œβ”€β”€ ::ffff:10.0.0.0/104
|               β”œβ”€β”€ ::ffff:169.254.0.0/112
|               β”œβ”€β”€ ::ffff:172.16.0.0/108
|               └── ::ffff:192.168.0.0/112
β”œβ”€β”€ Firewall settings:
|   β”œβ”€β”€ Enabled: yes
|   └── VPN input ports:
|       └── XX
β”œβ”€β”€ Log settings:
|   └── Log level: info
β”œβ”€β”€ Health settings:
|   β”œβ”€β”€ Server listening address: 127.0.0.1:9999
|   β”œβ”€β”€ Target address: cloudflare.com:443
|   β”œβ”€β”€ Duration to wait after success: 5s
|   β”œβ”€β”€ Read header timeout: 100ms
|   β”œβ”€β”€ Read timeout: 500ms
|   └── VPN wait durations:
|       β”œβ”€β”€ Initial duration: 6s
|       └── Additional duration: 5s
β”œβ”€β”€ Shadowsocks server settings:
|   └── Enabled: no
β”œβ”€β”€ HTTP proxy settings:
|   └── Enabled: no
β”œβ”€β”€ Control server settings:
|   β”œβ”€β”€ Listening address: :8000
|   └── Logging: yes
β”œβ”€β”€ OS Alpine settings:
|   β”œβ”€β”€ Process UID: 1000
|   └── Process GID: 1000
β”œβ”€β”€ Public IP settings:
|   β”œβ”€β”€ Fetching: every 12h0m0s
|   β”œβ”€β”€ IP file path: /tmp/gluetun/ip
|   └── Public IP data API: ipinfo
└── Version settings:
    └── Enabled: yes
2024-04-29T19:51:34Z WARN DNS address is set to XX so the DNS over TLS (DoT) server will not be used. The default value changed to 127.0.0.1 so it uses the internal DoT serves. If the DoT server fails to start, the IPv4 address of the first plaintext DNS server corresponding to the first DoT provider chosen is used.
2024-04-29T19:51:34Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1, assigned IP 172.18.0.2 and family v4
2024-04-29T19:51:34Z INFO [routing] adding route for 0.0.0.0/0
2024-04-29T19:51:34Z INFO [firewall] setting allowed subnets...
2024-04-29T19:51:34Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1, assigned IP 172.18.0.2 and family v4
2024-04-29T19:51:34Z INFO TUN device is not available: open /dev/net/tun: no such file or directory; creating it...
2024-04-29T19:51:34Z INFO [dns] using plaintext DNS at address XX
2024-04-29T19:51:34Z INFO [http server] http server listening on [::]:8000
2024-04-29T19:51:34Z INFO [healthcheck] listening on 127.0.0.1:9999
panic: runtime error: index out of range [0] with length 0
goroutine 31 [running]:
github.com/qdm12/gluetun/internal/provider/custom.getWireguardConnection(...)
	github.com/qdm12/gluetun/internal/provider/custom/connection.go:60
github.com/qdm12/gluetun/internal/provider/custom.(*Provider).GetConnection(_, {{0xc000028021, 0x9}, {{0x0, 0xffff9859a204}, 0xc000010018}, {0x0, 0x0, 0x0}, {0x0, ...}, ...}, ...)
	github.com/qdm12/gluetun/internal/provider/custom/connection.go:24 +0x35a
github.com/qdm12/gluetun/internal/vpn.setupWireguard({_, _}, {_, _}, {_, _}, {_, _}, {{0xc000028021, 0x9}, ...}, ...)
	github.com/qdm12/gluetun/internal/vpn/wireguard.go:20 +0xbe
github.com/qdm12/gluetun/internal/vpn.(*Loop).Run(0xc0002f2840, {0x1226060, 0xc0001d8b40}, 0xc00053cd20?)
	github.com/qdm12/gluetun/internal/vpn/run.go:40 +0x4df
created by main._main in goroutine 50
	./main.go:443 +0x33d7

Share your configuration

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - VPN_ENDPOINT_IP=X
      - VPN_ENDPOINT_PORT=X
      - WIREGUARD_PUBLIC_KEY=X
      - WIREGUARD_PRIVATE_KEY=X
      - WIREGUARD_ADDRESSES=X
      - DNS_ADDRESS=X
      - FIREWALL_VPN_INPUT_PORTS=6X

I can also confirm that I'm getting this error. I suggest you just change the Docker image to qmcgaw/gluetun:v3.38.0 (The previous latest stable version)

Also getting this error with the same error messages the previous posters provided.. Can confirm, changing image to v3 restores service.

I am also getting this error. Rolled back to container tag v3.38 for the time being

Just confirming the above as well. Latest container version using wireguard gets stuck in a crashloop caused by index out of range [0] with length 0, and rolling back to v3 resolves it.

Same here index out of range [0] with length 0

Thx

Also seeing this error on latest (72e2e4b). I'm using a protonvpn with port forwarding, which of course requires a custom provider. My docker command with volume bind mount paths edited for privacy:

docker run -it --rm --pull=always --cap-add=NET_ADMIN -e BLOCK_MALICIOUS=off -e VPN_TYPE=wireguard -e VPN_SERVICE_PROVIDER=custom -v /PATH/TO/CONF/conf.conf:/gluetun/wireguard/wg0.conf -e VPN_PORT_FORWARDING_PROVIDER=protonvpn -e VPN_PORT_FORWARDING=on -v gluetun:/gluetun -p 127.0.0.1:8888:8000 -p 8080:8080 -p 6881:6881 -p 6881:6881/udp --name my_qbt_gluetun qmcgaw/gluetun

Software versions:

  • Ubuntu 24.04
  • Docker version 26.1.0, build 9714adc
commented

Yeah this latest release is broken, rolling back to fix it for now.

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun:v3.38
    container_name: gluetun
    # line above must be uncommented to allow external containers to connect.
    # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun

Same here

Having the same issue.

It's better gluetun has separate stable and latest tags

I solved it by setting up a Wireguard VPN client in my router and put my server behind that router. And then excluding some domains for Plex through domain based VPN routing. :)

+1

Rolled back to v3.38.0 and back working.

commented

+1 getting this issue too, exact same logs

Same here, rolling back to the latest known-working version fixed the issue

Same here, had to rollback the version.

commented

Also seeing this error on latest (72e2e4b).

edit: Oh I think it's selection.Names[0] not being set if len(selection.Names) == 0

same indeed

hadn't seen this thread, but rolled back earlier due to it being borked

Fixed in b25ee21 sorry about that (bad commit pushed yesterday)

EDIT: @kainzilla thanks indeed, it was both set outside the if condition, and within the if condition, which was causing the crash if SEVER_NAMES was empty basically.

Closed issues are NOT monitored, so commenting here is likely to be not seen.
If you think this is still unresolved and have more information to bring, please create another issue.

This is an automated comment setup because @qdm12 is the sole maintainer of this project
which became too popular to monitor issues closed.

Also since you guys seem like living on the "latest" and rather quick at reporting issues, feel free to shoot me an email at quentin.mcgaw@gmail.com in case there is a panic bug in Gluetun. These are usually easily fixed and critical, so I'm happy to jump straight into it. I disabled notifications for Github issues/discussions given the large amount of them and for stress reasons, but I'm always happy to fix a panic! πŸ˜„

Also since you guys seem like living on the "latest" and rather quick at reporting issues, feel free to shoot me an email at quentin.mcgaw@gmail.com in case there is a panic bug in Gluetun. These are usually easily fixed and critical, so I'm happy to jump straight into it. I disabled notifications for Github issues/discussions given the large amount of them and for stress reasons, but I'm always happy to fix a panic! πŸ˜„

Thanks, I'll do that if I ever find another critical error. I do agree with @ShrirajHegde though, that there should be separate tags for the latest stable version and the latest unstable version. I know it would be easier for me if I was able to automatically upgrade to the latest stable version without manually setting the tag.

@westhecool @ShrirajHegde use the :v3 tag πŸ˜‰ See https://github.com/qdm12/gluetun-wiki/blob/main/setup/docker-image-tags.md
I could also add a :dev tag and have :latest mirror :v3, but I (shameful admission) like the quick feedback on the development I'm doing πŸ˜„ And also it feels like all the issues would come up when doing a "stable" (actually unstable) release (i.e. v3.39.0), so it's just pushing the problems to the release, and I'm doing my best to keep tagged v3.x.x images stable and non-buggy.

@qdm12 you can make the latest tag to be the development version and stable tag to be the stable version. Since latest is default, you are guaranteed to have some people running latest tag.

You can also double tag, like v3, stable together and dev, latest together