🐛 context canceled error on TrueNAS causes cloudflared not to start
Describe the bug cloudflared will not start on the TrueNAS platform after a not so recent upgrade
To Reproduce Steps to reproduce the behavior:
- Download an older version of
cloudflaredfrom the TrueNAS app store. Most likely in the June / August era. - Update to
2024.9.1or greater - Restart the truenas app
If it's an issue with Cloudflare Tunnel: 4. Tunnel ID : 4c12433b-bc15-40d4-81da-c9a3a77790a4 5. cloudflared config: UserID = 3000 GroupID = 3000 [ ] Host Network Storage Configuration Additional Storage Type: IX Volume [ ] Read Only Mount Path /cloudflared IX Volume Configuration [ ] Enable ACL Dataset Entry storage entry
Expected behavior cloudflared successfully starts on Truenas
Environment and versions
- OS: Truenas SCALE Dragonfish
- Architecture: x86
- Version: 24.04
Logs and errors
2024-11-01 22:31:09.550757-05:002024-11-02T03:31:09Z INF Starting tunnel tunnelID=4c12433b-bc15-40d4-81da-c9a3a77790a4
2024-11-01 22:31:09.550924-05:002024-11-02T03:31:09Z INF Version 2024.10.1 (Checksum b32e729d43adb66d22abf6539e287b436b1c312742c2488514ef6ea0a2d37adf)
2024-11-01 22:31:09.550981-05:002024-11-02T03:31:09Z INF GOOS: linux, GOVersion: go1.22.2-devel-cf, GoArch: amd64
2024-11-01 22:31:09.551016-05:002024-11-02T03:31:09Z INF Settings: map[no-autoupdate:true]
2024-11-01 22:31:09.551058-05:002024-11-02T03:31:09Z INF Environmental variables map[TUNNEL_TOKEN:*****]
2024-11-01 22:31:09.551520-05:002024-11-02T03:31:09Z INF Generated Connector ID: c28fcf15-43f2-46d9-af35-58d9899ba21a
2024-11-01 22:31:09.558107-05:002024-11-02T03:31:09Z INF Initial protocol quic
2024-11-01 22:31:09.570422-05:002024-11-02T03:31:09Z INF ICMP proxy will use 172.16.5.4 as source for IPv4
2024-11-01 22:31:09.570647-05:002024-11-02T03:31:09Z INF ICMP proxy will use fe80::4440:93ff:fe01:c130 in zone eth0 as source for IPv6
2024-11-01 22:31:09.578983-05:002024-11-02T03:31:09Z INF Starting metrics server on 127.0.0.1:46825/metrics
2024-11-01 22:31:09.581785-05:002024/11/02 03:31:09 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.
2024-11-01 22:31:09.610363-05:002024-11-02T03:31:09Z ERR Failed to serve quic connection error="context canceled" connIndex=0 event=0 ip=198.41.192.167
2024-11-01 22:31:09.610417-05:002024-11-02T03:31:09Z INF Retrying connection in up to 2s connIndex=0 event=0 ip=198.41.192.167
2024-11-01 22:31:10.074263-05:002024-11-02T03:31:10Z INF Tunnel server stopped
2024-11-01 22:31:10.074344-05:002024-11-02T03:31:10Z ERR Initiating shutdown error="context canceled"
2024-11-01 22:31:10.074391-05:002024-11-02T03:31:10Z ERR icmp router terminated error="context canceled"
2024-11-01 22:31:10.079701-05:002024-11-02T03:31:10Z INF Metrics server stopped
2024-11-01 22:31:10.079772-05:00context canceled
Additional context I was running cloudflared successfully on TrueNAS for a while and after upgrading either TrueNAS or cloudflared it is now refusing to start. Unfortunately I don't know which update has broken it - either TrueNAS or cloudflared.
Hi @seantcanavan, I'm facing the same issue. Have you managed to solve it?
EDIT: Issue is probably related to a bad tunnel token. I thought I needed cloudflared to run DDNS but it was installed to do tunnels for a previous project. FWIW, I went with wireguard via OPNSense rather than using cloudflare tunnels. It just seemed much simpler.
I got the same issue ElectricEel-24.10.1 cloudflare 2024.12.2
I was able to get it working with ElectricEel-24.10.1 cloudflare 2025.1.0
- Go into your truenas shell and update the max buffer size
sudo su
sysctl -w net.core.rmem_max=7500000
sysctl -w net.core.wmem_max=7500000
https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes#non-bsd
- Optional: Refresh your token in Cloudflare tunnel Dashboard
- Delete your cloudflared app and recreate it
Cloudflared should now run without any issues