Termux 上运行报错 panic: runtime error
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 38.1k
- Forks
- 4.6k
- Avg merge
- 19d 15h
- Merged PRs (30d)
- 1
Description
操作系统
Android
系统版本
Android 16
安装类型
sing-box 原始命令行程序
如果您使用图形客户端程序,请提供该程序版本。
No response
版本
sing-box version 1.14.0
Environment: go1.26.7 android/arm64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_cloudflared,with_usbip,with_openvpn,with_openconnect,badlinkname,tfogo_checklinkname0
Revision: 0b8995879f29a9b98ee027bc17b75e101445b238
CGO: enabled
描述
在 Android 系统,使用 Termux 运行 1.14.0 版本 sing-box 报错 panic: runtime error,同一配置 Windows 上运行正常
重现方式
运行配置文件
{
"log": {
"level": "info",
"timestamp": true
},
"dns": {
"servers": [
{
"type": "https",
"tag": "doh-ali",
"server": "223.5.5.5",
"tls": {
"server_name": "dns.alidns.com"
}
},
{
"type": "https",
"tag": "doh-google",
"server": "8.8.8.8",
"tls": {
"server_name": "dns.google"
},
"detour": "proxy"
}
],
"rules": [
{
"rule_set": [
"geosite-geolocation-cn"
],
"action": "route",
"server": "doh-ali"
},
{
"action": "evaluate",
"server": "doh-google"
},
{
"type": "logical",
"mode": "and",
"rules": [
{
"rule_set": "geosite-geolocation-!cn",
"invert": true
},
{
"match_response": true,
"rule_set": "geoip-cn"
}
],
"action": "route",
"server": "doh-google",
"client_subnet": "114.114.114.114/24"
}
],
"final": "doh-google",
"strategy": "ipv4_only"
},
"http_clients": [
{
"tag": "proxy-http",
"detour": "proxy"
}
],
"inbounds": [
{
"type": "socks",
"tag": "socks-in",
"listen": "127.0.0.1",
"listen_port": 1080
},
{
"type": "direct",
"tag": "dns-in",
"listen": "127.0.0.1",
"listen_port": 15353,
"network": "udp"
}
],
"outbounds": [
{
"type": "vless",
"tag": "proxy",
"server": "",
"server_port": 8080,
"uuid": "",
"flow": "xtls-rprx-vision",
"tls": {
"enabled": true,
"disable_sni": false,
"server_name": "",
"insecure": false,
"utls": {
"enabled": true,
"fingerprint": "chrome"
},
"reality": {
"enabled": true,
"public_key": "",
"short_id": ""
}
}
},
{
"type": "direct",
"tag": "direct"
}
],
"route": {
"rules": [
{
"inbound": "socks-in",
"action": "sniff"
},
{
"type": "logical",
"mode": "or",
"rules": [
{
"inbound": "dns-in"
},
{
"protocol": "dns"
},
{
"port": 53
}
],
"action": "hijack-dns"
},
{
"ip_is_private": true,
"action": "route",
"outbound": "direct"
},
{
"domain": [
"services.googleapis.cn"
],
"action": "route",
"outbound": "proxy"
},
{
"rule_set": [
"geoip-cn",
"geosite-geolocation-cn"
],
"action": "route",
"outbound": "direct"
}
],
"rule_set": [
{
"type": "remote",
"tag": "geoip-cn",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs"
},
{
"type": "remote",
"tag": "geosite-geolocation-cn",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs"
},
{
"type": "remote",
"tag": "geosite-geolocation-!cn",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-!cn.srs"
}
],
"final": "proxy",
"default_http_client": "proxy-http",
"default_domain_resolver": "doh-ali"
},
"experimental": {
"cache_file": {
"enabled": true
}
}
}
日志
+0800 2026-09-05 17:38:53 WARN network: initialize package manager: read packages list: open /data/system/packages.xml: permission denied
+0800 2026-09-05 17:38:53 INFO inbound/socks[socks-in]: tcp server started at 127.0.0.1:1080
+0800 2026-09-05 17:38:53 INFO inbound/direct[dns-in]: udp server started at 127.0.0.1:5353
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x57b8863d9c]
goroutine 1 [running]:
github.com/sagernet/sing-box/protocol/direct.(*Outbound).fetchMyAddresses(0x6dd29f2c00)
github.com/sagernet/sing-box/protocol/direct/outbound.go:102 +0x2c
github.com/sagernet/sing-box/protocol/direct.(*Outbound).Start(0x57b9be8350?, 0x80?)
github.com/sagernet/sing-box/protocol/direct/outbound.go:95 +0x50
github.com/sagernet/sing-box/adapter.LegacyStart({0x57b99fe780?, 0x6dd29f2c00}, 0x2?)
github.com/sagernet/sing-box/adapter/lifecycle_legacy.go:5 +0xc0
github.com/sagernet/sing-box/adapter/outbound.(*Manager).Start(0x6dd282d540, 0x2)
github.com/sagernet/sing-box/adapter/outbound/manager.go:86 +0x2ac
github.com/sagernet/sing-box/adapter.Start({0x57b9b43150, 0x6dd26254f0}, {0x57b9b6dca8, 0x6dd272ebd0}, 0x2, {0x6dd2aa12e8?, 0xa, 0x0?})
github.com/sagernet/sing-box/adapter/lifecycle.go:86 +0x134
github.com/sagernet/sing-box.(*Box).start(0x6dd256d680)
github.com/sagernet/sing-box/box.go:582 +0x1f0
github.com/sagernet/sing-box.(*Box).Start(0x6dd256d680)
github.com/sagernet/sing-box/box.go:507 +0x30
main.create({{0x6dd28e4000, 0xe02, 0x1000}, 0x0, {0x0, 0x0}, 0x6dd27465d0, 0x6dd28ba930, 0x0, 0x0, ...})
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:164 +0x31c
main.run()
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:190 +0x200
main.init.func86(0x6dd28cda00?, {0x57b56d7822?, 0x4?, 0x57b56d7826?})
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x1c
github.com/spf13/cobra.(*Command).execute(0x57b9c2da00, {0x6dd2841e20, 0x2, 0x2})
github.com/spf13/cobra@v1.10.2/command.go:1019 +0x7fc
github.com/spf13/cobra.(*Command).ExecuteC(0x57b9c1e880)
github.com/spf13/cobra@v1.10.2/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.10.2/command.go:1071
main.main()
github.com/sagernet/sing-box/cmd/sing-box/main.go:8 +0x24
支持我们
- 我已经 赞助
完整性要求
- 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
- 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
- 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with protocol/direct/outbound.go at fetchMyAddresses and Outbound.Start, then trace the startup path through adapter/lifecycle_legacy.go and box.go. Reproduce the configuration under Termux on Android and identify why the direct outbound dereferences a nil value. Done means sing-box starts without the panic while preserving direct outbound initialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, networking, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100