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.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.71k stars 331 forks source link

Bug: Error while connecting #2244

Closed needsupport closed 1 month ago

needsupport commented 2 months ago

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
github-actions[bot] commented 2 months ago

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

westhecool commented 2 months ago

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)

khaosx commented 2 months ago

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

CplPwnies commented 2 months ago

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

jeff-t-d commented 2 months ago

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.

mblanco4x4 commented 2 months ago

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

Thx

fastily commented 2 months ago

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:

minicoz commented 2 months ago

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
blixten85 commented 2 months ago

metoo

hot22shot commented 2 months ago

Same here

ShrirajHegde commented 2 months ago

Having the same issue.

It's better gluetun has separate stable and latest tags

blixten85 commented 2 months ago

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

jamespoore commented 2 months ago

+1

Rolled back to v3.38.0 and back working.

othyn commented 2 months ago

+1 getting this issue too, exact same logs

lemisieur commented 1 month ago

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

cronyakatsuki commented 1 month ago

Same here, had to rollback the version.

kainzilla commented 1 month ago

Also seeing this error on latest (72e2e4b).

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

machie27 commented 1 month ago

same indeed

jimbobjonesbob commented 1 month ago

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

qdm12 commented 1 month ago

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.

github-actions[bot] commented 1 month ago

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.

qdm12 commented 1 month ago

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! 😄

westhecool commented 1 month ago

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.

qdm12 commented 1 month ago

@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.

ShrirajHegde commented 1 month ago

@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