box_for_magisk
box_for_magisk copied to clipboard
Can't turn on TUN,Start TUN listening error: build android rules: read packages list: invalid interned reference: 65280, exists: 35
Version: 1.4.3 Core: mihomo phone: meizu20pro network_mode="mixed" tun=true issue= tun mode can't turn on,error show as log below。and the entire device cannot connect to the network. checked: command "ifconfig" not found "utun" or "tun*",/dev/net/tun dynamic link is correctly established.
run log:
08:49 pm [Info]: Good day
08:49 pm [Info]: xclash [ mihomo ] setup completed
08:49 pm [Info]: Current busybox v1.36.1
08:49 pm [Info]: Using kernel in /data/adb/box/bin/clash.
08:49 pm [Info]: Mihomo Meta alpha-ee6b974 android arm64 with go1.20.11 Tue Dec 5 12:31:26 UTC 2023
Use tags: with_gvisor
08:49 pm [Info]: deleting and backup logs
08:49 pm [Info]: crontab disabled.
08:49 pm [Info]: client-list: [ clash sing-box xray v2fly ]
08:49 pm [Info]: choose: clash, start the service.
08:49 pm [Info]: config /data/adb/box/clash/config.yaml
08:49 pm [Info]: type (tun) already exists in /data/adb/box/clash/config.yaml
08:49 pm [Info]: clash service is running.
08:49 pm [Info]: Proxy-mode: blacklist, Network-mode: mixed
08:49 pm [Info]: clash has started with the 'root:net_admin' user group.
08:49 pm [Info]: clash status: S (sleeping) (PID: 8812)
08:49 pm [Info]: clash memory usage: 70 MB, swap: 0 KB
08:49 pm [Info]: clash CPU usage: 28.1%
08:49 pm [Info]: clash list of allowed CPUs : 0-7
08:49 pm [Info]: clash Which CPU running on : 3
08:49 pm [Info]: battery temperature: 32°C
08:49 pm [Info]: clash running time: 0:04
08:49 pm [Debug]: enhanced-mode: redir-host, fake-ip-range: 198.18.0.1/16, listen-port: 1053, mode: rule
08:49 pm [Info]: Using Mixed: tcp(redirect) + udp(tun).
08:49 pm [Info]: Creating iptables transparent proxy rules.
08:49 pm [Info]: ap+ wlan+ rndis+ swlan+ transparent proxy.
08:49 pm [Info]: Transparent proxy for all apps.
08:49 pm [Info]: Creating iptables transparent proxy rules done.
08:49 pm [Warning]: Disabling IPv6.
08:49 pm [Warning]: tun_device: 'utun' not found
08:49 pm [Info]: clash connected.
Clash.log:
45773705Z] Start initial configuration in progress
[36mINFO[0m[2023-12-05T12:49:49.746585059Z] Geodata Loader mode: memconservative
[36mINFO[0m[2023-12-05T12:49:49.751334643Z] Start initial GeoIP rule private => 🎯 全球直连, records: 18
[36mINFO[0m[2023-12-05T12:49:49.860967924Z] Start initial GeoSite rule private => 🎯 全球直连, records: 136
[36mINFO[0m[2023-12-05T12:49:49.938307612Z] Start initial GeoSite rule category-ads-all => 🍃 广告过滤, records: 66019
[36mINFO[0m[2023-12-05T12:49:49.958445476Z] Start initial GeoSite rule geolocation-!cn => 🚀 节点选择, records: 19340
[36mINFO[0m[2023-12-05T12:49:49.964131674Z] Start initial GeoIP rule !CN => 🚀 节点选择, records: 10537
[36mINFO[0m[2023-12-05T12:49:49.964314226Z] Initial configuration complete, total time: 218ms
[36mINFO[0m[2023-12-05T12:49:49.965173861Z] RESTful API listening at: [::]:9090
[36mINFO[0m[2023-12-05T12:49:50.020001101Z] Sniffer is closed
[36mINFO[0m[2023-12-05T12:49:50.020024486Z] Use tcp concurrent
[36mINFO[0m[2023-12-05T12:49:50.020283861Z] DNS server listening at: [::]:1053
[36mINFO[0m[2023-12-05T12:49:50.020552299Z] Redirect proxy listening at: [::]:9797
[36mINFO[0m[2023-12-05T12:49:50.020695476Z] Mixed(http+socks) proxy listening at: [::]:7890
[33mWARN[0m[2023-12-05T12:49:50.021631153Z] [TUN] default interface changed by monitor, => wlan0
[31mERRO[0m[2023-12-05T12:49:50.026778445Z] Start TUN listening error: build android rules: read packages list: invalid interned reference: 65280, exists: 35
[33mWARN[0m[2023-12-05T12:53:14.849426023Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:48716 --> 124.70.116.158:5223 error: dial tcp 124.70.116.158:5223: i/o timeout
[33mWARN[0m[2023-12-05T12:53:14.986298627Z] [TCP] dial 🎯 全球直连 (match RuleSet/Tencent) 10.3.235.194:45948 --> dns.weixin.qq.com.cn:443 error: dial tcp 116.130.224.205:443: i/o timeout
dial tcp 111.206.147.210:443: i/o timeout
dial tcp 116.130.224.150:443: i/o timeout
dial tcp 60.28.172.100:443: i/o timeout
dial tcp 111.206.147.156:443: i/o timeout
dial tcp 111.206.148.27:443: i/o timeout
[33mWARN[0m[2023-12-05T12:53:15.032235137Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:39418(com.tencent.mm, uid=10207) --> 157.255.209.167:80 error: dial tcp 157.255.209.167:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:16.022459772Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:40464(com.tencent.mm, uid=10207) --> 157.255.191.75:80 error: dial tcp 157.255.191.75:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:16.828463835Z] [TCP] dial 🎯 全球直连 (match RuleSet/Tencent) 10.3.235.194:37392 --> h.trace.qq.com:443 error: dial tcp 116.162.34.57:443: i/o timeout
dial tcp 116.162.34.122:443: i/o timeout
[33mWARN[0m[2023-12-05T12:53:17.546451751Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:49052(com.tencent.mm, uid=10207) --> 157.255.191.88:443 error: dial tcp 157.255.191.88:443: i/o timeout
[33mWARN[0m[2023-12-05T12:53:17.916480449Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:47790 --> 157.148.47.172:8002 error: dial tcp 157.148.47.172:8002: i/o timeout
[33mWARN[0m[2023-12-05T12:53:20.04150899Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:43070(com.tencent.mm, uid=10207) --> 157.255.209.219:80 error: dial tcp 157.255.209.219:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:21.839872739Z] [TCP] dial 🎯 全球直连 (match RuleSet/Tencent) 10.3.235.194:37820 --> h.trace.qq.com:443 error: dial tcp 116.162.34.122:443: i/o timeout
dial tcp 116.162.34.57:443: i/o timeout
[33mWARN[0m[2023-12-05T12:53:22.558255082Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:38466(com.tencent.mm, uid=10207) --> 157.255.209.167:443 error: dial tcp 157.255.209.167:443: i/o timeout
[33mWARN[0m[2023-12-05T12:53:23.082151124Z] [TCP] dial 🎯 全球直连 (match RuleSet/Tencent) 10.3.235.194:44446 --> dns.weixin.qq.com.cn:80 error: dial tcp 60.28.172.100:80: i/o timeout
dial tcp 111.206.147.210:80: i/o timeout
dial tcp 111.206.147.156:80: i/o timeout
dial tcp 111.206.148.27:80: i/o timeout
dial tcp 116.130.224.205:80: i/o timeout
dial tcp 116.130.224.150:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:23.083489041Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:49700(com.tencent.mm, uid=10207) --> 157.148.49.105:80 error: dial tcp 157.148.49.105:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:25.058747425Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:46612(com.tencent.mm, uid=10207) --> 157.255.191.88:80 error: dial tcp 157.255.191.88:80: i/o timeout
[33mWARN[0m[2023-12-05T12:53:27.570720549Z] [TCP] dial 🎯 全球直连 (match Match/) 10.3.235.194:43210(com.tencent.mm, uid=10207) --> 183.47.122.25:8080 error: dial tcp 183.47.122.25:8080: i/o timeout
config.yaml:
redir-port: 9797
mixed-port: 7890
tproxy-port: 9898
mode: rule
allow-lan: true
unified-delay: false
tcp-concurrent: true
enable-process: true
find-process-mode: strict
bind-address: '*'
log-level: debug
ipv6: false
external-controller: 0.0.0.0:9090
external-ui: /data/adb/box/clash/dashboard
secret: ""
#external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"
#面板可选,打开dashboard文件夹自行查看和修改
#interface-name: tun0 #出口网卡名称 可用来桥接VPN类软件
geodata-mode: true
geox-url:
geoip: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
geosite: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
mmdb: "https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb"
geo-auto-update: true # 是否自动更新 geodata
geo-update-interval: 1 # 更新间隔,单位:小时
profile:
store-selected: true
store-fake-ip: true
sniffer:
enable: false
sniff:
TLS:
ports: [443, 8443]
HTTP:
ports: [80, 8080-8880]
override-destination: true
tun:
enable: true
device: utun
stack: system
#可切换# gvisor / lwip / system
dns-hijack:
- any:53
- tcp://any:53
auto-route: true
auto-detect-interface: true
strict-route: false
include-android-user: [0, 10]
dns:
enable: true
listen: 0.0.0.0:1053
prefer-h3: true
ipv6: false
enhanced-mode: redir-host #fake-ip
use-hosts: true
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- localhost.ptlogin2.qq.com
- '*.lan'
- '*.linksys.com'
- '*.ntp.*'
nameserver:
- https://223.5.5.5/dns-query
- https://120.53.53.53/dns-query
proxy-server-nameserver:
- https://120.53.53.53/dns-query
- https://223.5.5.5/dns-query
namesever-policy:
"geosite:cn,private,googlefcm":
- https://223.5.5.5/dns-query
- https://120.53.53.53/dns-query
"rule-set:GoogleFCM":
- https://223.5.5.5/dns-query
- https://120.53.53.53/dns-query
"rule-set:userDirect":
- https://223.5.5.5/dns-query
- https://120.53.53.53/dns-query
"geosite:geolocation-!cn":
- https://8.8.4.4/dns-query#DNS
- https://1.0.0.1/dns-query#DNS
"geoip:!cn":
- https://8.8.4.4/dns-query#DNS
- https://1.0.0.1/dns-query#DNS
"rule-set:userProxy":
- https://223.5.5.5/dns-query#DNS
- https://120.53.53.53/dns-query#DNS
proxies:
p: &p
type: http
interval: 1800
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 120
fb: &fb
type: fallback
url: http://www.gstatic.com/generate_204
interval: 180
tolerance: 30
use:
- EFcloud
- Free
s: &s
type: select
use:
- EFcloud
- Free
t: &t
type: url-test
url: http://www.gstatic.com/generate_204
interval: 120
tolerance: 30
use:
- EFcloud
- Free
pr: &pr
type: select
proxies:
- 🚀 节点选择
- ♻️ 自动选择
- 🇸🇬 新加坡节点
- 🇭🇰 香港节点
- 🇨🇳 台湾节点
- 🇯🇵 日本节点
- 🇺🇲 美国节点
- 🏳️🌈 原生/解锁
- 🏳️⚧️ 其他地区
- 专线
- 直连
- PASS
c: &c
type: http
behavior: classical
interval: 86400
f: &f
type: file
behavior: classical
#——————————————————————————————————————————————————
proxy-providers:
EFcloud:
<<: *p
url: ""
path: ./provide/EFcloud.yaml
Free:
<<: *p
url: "https://jetstream.site/api/v1/public/services/41618/55d7412e848eedfb93100a9c56f570f8?client=clash"
path: ./provide/free.yaml
#——————————————————————————————————————————————————
proxy-groups:
- name: DNS
type: select
proxies:
- 🇺🇲 美国节点
- 🇯🇵 日本节点
- 🇭🇰 香港节点
- 🇨🇳 台湾节点
- 🇸🇬 新加坡节点
- 🏳️⚧️ 其他地区
- 直连
- name: 🚀 节点选择
type: select
proxies:
- 🚧 故障转移
- ♻️ 自动选择
- 🇸🇬 新加坡节点
- 🇭🇰 香港节点
- 🇨🇳 台湾节点
- 🇯🇵 日本节点
- 🇺🇲 美国节点
- 🏳️🌈 原生/解锁
- 🏳️⚧️ 其他地区
- 专线
- 直连
- name: 专线
filter: "IPLC|IEPL|CN2|GAPN|CUVIP|AIA|iplc|iepl"
<<: *s
- name: 🚧 故障转移
proxies:
- 🛵 直连节点
- ♻️ 自动选择
<<: *fb
- name: 🛵 直连节点
filter: "直连|direct"
<<: *s
- name: 🏳️🌈 原生/解锁
filter: "原生|解锁"
<<: *s
- name: 🏳️⚧️ 其他地区
filter: "^((?!(🇭🇰|香港|HK|HongKong|Hong Kong|HKG|🇸🇬|新加坡|狮城|Singapore|SG|🇯🇵|日|日本|东京|Japan|JP|🇺🇲|美|美国|US|United States|UnitedStates|America|Korea|KR|🇹🇼|台|台湾|TW|Tai Wan)).)*$"
<<: *s
- name: 🇺🇲 美国节点
filter: "🇺🇲|美|美国|US|United States|UnitedStates|America"
<<: *fb
- name: 🇭🇰 香港节点
filter: "🇭🇰|香港|HK|HongKong|HKG|Hong Kong"
<<: *t
- name: 🇨🇳 台湾节点
filter: "🇹🇼|台|台湾|TW|Tai Wan"
<<: *t
- name: 🇸🇬 新加坡节点
filter: "🇸🇬|新加坡|狮城|Singapore|SG"
<<: *t
- name: 🇯🇵 日本节点
filter: "🇯🇵|日|日本|东京|Japan|JP"
<<: *t
- name: ♻️ 自动选择
<<: *t
#——————————————————————————————————————————————————
- name: 🌎 GoogleFCM
<<: *pr
- name: 📢 Google
<<: *pr
- name: 📲 Telegram
<<: *pr
- name: 🧺 Amazon
<<: *pr
- name: 📺 Netflix
<<: *pr
- name: 📹 YouTube
<<: *pr
- name: 🍋 BiliBili
<<: *pr
- name: 🎮 Games
<<: *pr
- name: 🪟 Microsoft
<<: *pr
#——————————————————————————————————————————————————
- name: 🎯 全球直连
type: select
proxies:
- 直连
- 🚀 节点选择
- name: 🍃 广告过滤
type: select
proxies:
- 拦截
- PASS
- name: 直连
type: select
proxies:
- DIRECT
- name: 拦截
type: select
proxies:
- REJECT
#——————————————————————————————————————————————————
rule-providers:
userProxy:
<<: *f
path: ./rule_providers/userProxy.yaml
userDirect:
<<: *f
path: ./rule_providers//userDirect.yaml
GoogleFCM:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GoogleFCM/GoogleFCM.yaml"
path: ./rule_providers/GoogleFCM.yaml
Google:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml"
path: ./rule_providers/Google.yaml
Amazon:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Amazon/Amazon.yaml"
path: ./rule_providers/Amazon.yaml
YouTube:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml"
path: ./rule_providers/YouTube.yaml
Microsoft:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Microsoft/Microsoft.yaml"
path: ./rule_providers/Microsoft.yaml
Telegram:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Telegram/Telegram.yaml"
path: ./rule_providers/Telegram.yaml
Netflix:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix.yaml"
path: ./rule_providers/Netflix.yaml
GitHub:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GitHub/GitHub.yaml"
path: ./rule_providers/GitHub.yaml
BiliBili:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/BiliBili/BiliBili.yaml"
path: ./rule_providers/BiliBili.yaml
Advertising:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Advertising/Advertising_Classical.yaml"
path: ./rule_providers/Advertising.yaml
WeChat:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/WeChat/WeChat.yaml"
path: ./rule_providers/WeChat.yaml
Tencent:
<<: *c
url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Tencent/Tencent.yaml"
path: ./rule_providers/Tencent.yaml
#——————————————————————————————————————————————————
rules:
- RULE-SET,userDirect,🎯 全球直连
- RULE-SET,userProxy,🚀 节点选择
- RULE-SET,WeChat,🎯 全球直连
- RULE-SET,Tencent,🎯 全球直连
- RULE-SET,GoogleFCM,🌎 GoogleFCM
- RULE-SET,Amazon,🧺 Amazon
- RULE-SET,Google,📢 Google
- RULE-SET,YouTube,📹 YouTube
- RULE-SET,Netflix,📺 Netflix
- RULE-SET,Microsoft,🪟 Microsoft
- RULE-SET,GitHub,🪟 Microsoft
- RULE-SET,Telegram,📲 Telegram
- RULE-SET,BiliBili,🍋 BiliBili
- RULE-SET,Advertising,🍃 广告过滤
- GEOIP,private,🎯 全球直连
- GEOSITE,private,🎯 全球直连
- GEOSITE,category-ads-all,🍃 广告过滤
- GEOSITE,geolocation-!cn,🚀 节点选择
- GEOIP,!CN,🚀 节点选择
- MATCH,🎯 全球直连
setting.ini:
#!/system/bin/sh
if [ ! -d /data/adb/modules/busybox-ndk ]; then
export PATH="/data/adb/magisk:/data/adb/ksu/bin:$PATH:/system/bin"
fi
# Take the current time
current_time=$(date +"%I:%M %P")
# define the settings and paths
settings="/data/adb/box/settings.ini"
# set the port numbers for tproxy and redir
tproxy_port="9898"
redir_port="9797"
# enable/disable port detection: true / false
port_detect="false"
# enable/disable IPv6: true / false
ipv6="false"
# list of available kernel binaries
bin_list=( "clash" "sing-box" "xray" "v2fly" )
# for run and download premium or mihomo
# put kernel premium and mihomo into /data/adb/box/bin directory
xclash_option="mihomo"
# select the client to use : clash / sing-box / xray / v2fly
bin_name=clash
# This script is used to set the user and group for the BFM core files.
box_user_group="root:net_admin"
# redirect: tcp only,
# tproxy: for tcp + udp with tproxy,
# mixed: mode with redirect[tcp] + tun[udp]
network_mode="mixed"
# blacklist / whitelist / tun (only tun auto-route)
proxy_mode="blacklist"
# list of package names to be proxied
# android Package Name, For example: ("com.android.captiveportallogin" "com.tencent.mm")
packages_list=()
# The gid in the list will be bypassed or proxied according to the proxy_mode configuration, and the gid can be arbitrarily specified by the busybox setuidgid command
gid_list=()
# Display AP info by typing "ifconfig" in terminal
ap_list=( "ap+" "wlan+" "rndis+" "swlan+" )
# Ignore AP in the out list
ignore_out_list=()
# Set cgroup to limit memory usage
cgroup_memcg="false"
memcg_limit="25M"
# Set cgroup to cpuset usage
cgroup_cpuset="false"
# 0f=0-3 / f0=4-7 / ff=0-7, recommended default: ff
mask_cpuset="ff"
# Set cgroup to blkio usage
cgroup_blkio="false"
# Set box directory variables
box_dir="/data/adb/box"
box_run="${box_dir}/run"
box_log="${box_run}/runs.log"
box_pid="${box_run}/box.pid"
bin_dir="${box_dir}/bin"
bin_path="${bin_dir}/${bin_name}"
# if you don't want to generate the /run/${bin_name}.log file (because it will grow in size over time), replace "${box_run}/${bin_name}.log" to "/dev/null"
bin_log="${box_run}/${bin_name}.log"
# bin_log="/dev/null"
system_packages_file="/data/system/packages.list"
uid_list=("/data/adb/box/run/appuid.list")
# Update subscription & geox
# Set update interval using cron, for more information: https://crontab.guru/
# set 'true' to enable Cron job
interva_update="0 0,6,12,18,22 * * *" # will update every hour 00,06,12,18
run_crontab="false"
# type "su -c /data/adb/box/scripts/box.tool geox" to update geox
update_geo="false"
# if "renew=true" it will update config.yaml not subscription configuration
# type "su -c /data/adb/box/scripts/box.tool subs" to update subscription
renew=false
update_subscription="false"
# ex: clash subscription url
subscription_url_clash="" # this is just an example.
# clash configuration
name_clash_config="config.yaml"
clash_config="${box_dir}/clash/${name_clash_config}"
# clash subscription
name_provide_clash_config="subscription.yaml"
clash_provide_config="${box_dir}/clash/provide/${name_provide_clash_config}"
# support rules specified in subscriptions, This is useful when the subscription contains customized rules as well.
custom_rules_subs="false"
name_provide_clash_rules="rules.yaml"
clash_provide_rules="${box_dir}/clash/provide/${name_provide_clash_rules}"
# sing configuration
name_sing_config="config.json"
sing_config="${box_dir}/sing-box/${name_sing_config}"
normal="\033[0m"
orange="\033[1;38;5;208m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
blue="\033[1;34m"
log() {
# Selects the text color according to the parameters
case $1 in
Info) color="${blue}" ;;
Error) color="${red}" ;;
Warning) color="${yellow}" ;;
*) color="${green}" ;;
esac
# Add messages to time and parameters
message="${current_time} [$1]: $2"
if [ -t 1 ]; then
# Prints messages to the console
echo -e "${color}${message}${normal}"
else
# Print messages to a log file
echo "${message}" >> ${box_log} 2>&1
fi
}