MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
15.28k stars 2.53k forks source link

[Bug] Cannot start TUN device #1458

Closed qiangxinglin closed 2 weeks ago

qiangxinglin commented 3 weeks ago

Verify steps

Operating System

Linux

System Version

Linux 3.10.0-1160.80.1.el7.x86_64 SMP x86_64 x86_64 x86_64 GNU/Linux

Mihomo Version

Mihomo Meta v1.18.7 linux amd64 with go1.22.5 Sun Jul 28 05:46:59 UTC 2024 Use tags: with_gvisor

Configuration File

mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: debug

dns:
  enable: true
  ipv6: false
  listen: :23453
  default-nameserver:
    - 223.5.5.5
    - 8.8.8.8
  enhanced-mode: redir-host
  nameserver:
    - https://223.5.5.5/dns-query
    - tls://101.101.101.101:853
    - https://1.12.12.12/dns-query
  fallback:
    - https://doh.dns.sb/dns-query
    - tcp://208.67.222.222:443
    - tls://dns.google

tun:
  enable: true
  stack: mixed
  auto-route: true
  auto-redirect: true
  auto-detect-interface: true
  device: utun0
  strict-route: true
  udp-timeout: 300
  endpoint-independent-nat: false
  include-uid:
  - 1999

rule-providers:
  reject:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400

  icloud:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
    path: ./ruleset/icloud.yaml
    interval: 86400

  apple:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
    path: ./ruleset/apple.yaml
    interval: 86400

  google:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
    path: ./ruleset/google.yaml
    interval: 86400

  proxy:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
    path: ./ruleset/proxy.yaml
    interval: 86400

  direct:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
    path: ./ruleset/direct.yaml
    interval: 86400

  private:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
    path: ./ruleset/private.yaml
    interval: 86400

  gfw:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
    path: ./ruleset/gfw.yaml
    interval: 86400

  tld-not-cn:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
    path: ./ruleset/tld-not-cn.yaml
    interval: 86400

  telegramcidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
    path: ./ruleset/telegramcidr.yaml
    interval: 86400

  cncidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
    path: ./ruleset/cncidr.yaml
    interval: 86400

  lancidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
    path: ./ruleset/lancidr.yaml
    interval: 86400

  applications:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt"
    path: ./ruleset/applications.yaml
    interval: 86400

proxies:
  - {name: X}

proxy-groups:
  - name: PROXY
    type: select
    proxies:
      - X
  - name: Others
    type: select
    proxies:
      - PROXY
      - DIRECT

rules:
  - RULE-SET,private,DIRECT
  - RULE-SET,reject,REJECT
  - RULE-SET,google,PROXY
  - RULE-SET,proxy,PROXY
  - RULE-SET,direct,DIRECT
  - RULE-SET,lancidr,DIRECT
  - RULE-SET,cncidr,DIRECT
  - RULE-SET,telegramcidr,PROXY
  - GEOIP,LAN,DIRECT
  - GEOIP,CN,DIRECT
  - MATCH,Others

Description

Start clash, logs:

INFO[2024-08-18T23:30:59.223947331+08:00] Start initial configuration in progress      
INFO[2024-08-18T23:30:59.22504096+08:00] Geodata Loader mode: memconservative         
INFO[2024-08-18T23:30:59.22509622+08:00] Geosite Matcher implementation: succinct     
INFO[2024-08-18T23:30:59.243977362+08:00] Initial configuration complete, total time: 19ms 
INFO[2024-08-18T23:30:59.265714988+08:00] Sniffer is closed                            
INFO[2024-08-18T23:30:59.266016806+08:00] DNS server listening at: [::]:23453          
INFO[2024-08-18T23:30:59.266438688+08:00] Mixed(http+socks) proxy listening at: [::]:7890 
WARN[2024-08-18T23:30:59.273849578+08:00] [TUN] default interface changed by monitor,  => bond0 
ERRO[2024-08-18T23:30:59.411318004+08:00] Start TUN listening error: configure tun interface: add rule 1/11: file exists

If I comment out the tun > include-uid

tun:
  enable: true
  stack: mixed
  auto-route: true
  auto-redirect: true
  auto-detect-interface: true
  device: utun0
  strict-route: true
  udp-timeout: 300
  endpoint-independent-nat: false
  # include-uid:   <- here
  # - 1999         <- here

The startup logs become:

INFO[2024-08-18T23:34:51.857996404+08:00] Start initial configuration in progress      
INFO[2024-08-18T23:34:51.858976601+08:00] Geodata Loader mode: memconservative         
INFO[2024-08-18T23:34:51.859010061+08:00] Geosite Matcher implementation: succinct     
INFO[2024-08-18T23:34:51.878533427+08:00] Initial configuration complete, total time: 20ms 
INFO[2024-08-18T23:34:51.906691955+08:00] Sniffer is closed                            
INFO[2024-08-18T23:34:51.907066065+08:00] DNS server listening at: [::]:23453          
INFO[2024-08-18T23:34:51.907652817+08:00] Mixed(http+socks) proxy listening at: [::]:7890 
WARN[2024-08-18T23:34:51.918405556+08:00] [TUN] default interface changed by monitor,  => bond0 
ERRO[2024-08-18T23:34:52.193525199+08:00] Start TUN listening error: auto redirect: conn.Receive: netlink receive: numerical result out of range | netlink receive: no such file or directory

If I comment out the tun > auto-redirect

tun:
  enable: true
  stack: mixed
  auto-route: true
  # auto-redirect: true  <- here
  auto-detect-interface: true
  device: utun0
  strict-route: true
  udp-timeout: 300
  endpoint-independent-nat: false
  # include-uid:   <- here
  # - 1999         <- here

The startup logs become (successfully startup):

INFO[2024-08-19T10:39:41.383316663+08:00] Start initial configuration in progress      
INFO[2024-08-19T10:39:41.384345913+08:00] Geodata Loader mode: memconservative         
INFO[2024-08-19T10:39:41.384489977+08:00] Geosite Matcher implementation: succinct     
INFO[2024-08-19T10:39:41.410392222+08:00] Initial configuration complete, total time: 26ms 
INFO[2024-08-19T10:39:41.439234076+08:00] Sniffer is closed                
INFO[2024-08-19T10:39:41.439537963+08:00] DNS server listening at: [::]:23453          
INFO[2024-08-19T10:39:41.439902044+08:00] Mixed(http+socks) proxy listening at: [::]:7890 
WARN[2024-08-19T10:39:41.444352072+08:00] [TUN] default interface changed by monitor,  => bond0 
INFO[2024-08-19T10:39:41.465841208+08:00] [TUN] Tun adapter listening at: utun0([198.18.0.1/30],[]), mtu: 9000, auto route: true, auto redir: false, ip stack: Mixed

Reproduction Steps

run clash as normal: ./clash -d /etc/clash

Logs

No response

xishang0128 commented 3 weeks ago

Your kernel is too outdated, which might cause issues with iptables and other features being incompatible with new updates. Please consider upgrading your kernel.

AnyWAT commented 2 weeks ago

@FlightGitHub [BUG] 开启tun模式,虚拟网卡没有出现 https://github.com/clash-verge-rev/clash-verge-rev/issues/1589 WIN10下即使没开 tun 模式——error:PrepareUIPath error: ExternalUI configure incomplete 是近期2-3个礼拜的内核 verge-mihomo-alpha 的问题,改用正式版即可正常。

300多M就内存泄露吗,我一直二百多,稳定200多。你有一直涨上去?

是的,平常50M以下的,一直涨,快到1G了,刚刚正常使用的节点测试也全部 error,换了正式版内核,立马恢复正常。

qiangxinglin commented 2 weeks ago

Problem solved by upgrade kernel to Linux 5.4.278-1.el7.elrepo.x86_64 x86_64