gluetun icon indicating copy to clipboard operation
gluetun copied to clipboard

Bug: Error while connecting

Open needsupport opened this issue 9 months ago • 9 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

needsupport avatar Apr 29 '24 19:04 needsupport

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

  • do not ask for updates, be patient
  • :+1: the issue to show your support instead of commenting @qdm12 usually checks issues at least once a week, if this is a new urgent bug, revert to an older tagged container image

github-actions[bot] avatar Apr 29 '24 19:04 github-actions[bot]

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)

westhecool avatar Apr 29 '24 20:04 westhecool

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

khaosx avatar Apr 29 '24 20:04 khaosx

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

CplPwnies avatar Apr 29 '24 21:04 CplPwnies

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.

jeff-t-d avatar Apr 29 '24 21:04 jeff-t-d

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

Thx

mblanco4x4 avatar Apr 29 '24 21:04 mblanco4x4

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

fastily avatar Apr 29 '24 22:04 fastily

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

minicoz avatar Apr 29 '24 23:04 minicoz

#metoo

blixten85 avatar Apr 30 '24 04:04 blixten85

Same here

hot22shot avatar Apr 30 '24 07:04 hot22shot

Having the same issue.

It's better gluetun has separate stable and latest tags

ShrirajHegde avatar Apr 30 '24 07:04 ShrirajHegde

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. :)

blixten85 avatar Apr 30 '24 07:04 blixten85

+1

Rolled back to v3.38.0 and back working.

jamespoore avatar Apr 30 '24 08:04 jamespoore

+1 getting this issue too, exact same logs

othyn avatar Apr 30 '24 09:04 othyn

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

lemisieur avatar Apr 30 '24 11:04 lemisieur

Same here, had to rollback the version.

cronyakatsuki avatar Apr 30 '24 13:04 cronyakatsuki

Also seeing this error on latest (72e2e4b).

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

kainzilla avatar Apr 30 '24 17:04 kainzilla

same indeed

machie27 avatar Apr 30 '24 18:04 machie27

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

jimbobjonesbob avatar May 01 '24 08:05 jimbobjonesbob

Fixed in b25ee21e3e05f12c3b43930dacfc0e286c24da54 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.

qdm12 avatar May 01 '24 19:05 qdm12

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.

github-actions[bot] avatar May 01 '24 19:05 github-actions[bot]

Also since you guys seem like living on the "latest" and rather quick at reporting issues, feel free to shoot me an email at [email protected] 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! 😄

qdm12 avatar May 01 '24 20:05 qdm12

Also since you guys seem like living on the "latest" and rather quick at reporting issues, feel free to shoot me an email at [email protected] 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 avatar May 01 '24 20:05 westhecool

@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 avatar May 01 '24 20:05 qdm12

@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

ShrirajHegde avatar May 01 '24 20:05 ShrirajHegde