Skip to content

[Bug] process name cannot be found, running with systemd #961

Description

@kongxu633

Verify steps

  • 确保你使用的是本仓库最新的的 mihomo 或 mihomo Alpha 版本 Ensure you are using the latest version of Mihomo or Mihomo Alpha from this repository.
  • 如果你可以自己 debug 并解决的话,提交 PR 吧 Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
  • 我已经使用 Alpha 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
  • 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
  • 这是 Mihomo 核心的问题,并非我所使用的 Mihomo 衍生版本(如 OpenMihomo、KoolMihomo 等)的特定问题 This is an issue of the Mihomo core per se, not to the derivatives of Mihomo, like OpenMihomo or KoolMihomo.

Mihomo version

Mihomo Meta v1.18.0 linux amd64 with go1.21.5

What OS are you seeing the problem on?

Ubuntu 22.04.3 LTS

Mihomo config

------------mihomo.service------------

[Service]
Type=simple
LimitNPROC=500
LimitNOFILE=1000000
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME
Restart=always
ExecStartPre=/usr/bin/sleep 1s
ExecStart=/usr/local/bin/mihomo -d /etc/mihomo
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target



------------config.yaml------------


find-process-mode: always

tun:
  enable: true
  stack: system
  auto-route: true
  auto-detect-interface: true
  dns-hijack:
    - any:53

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
  applications:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt"
    path: ./ruleset/applications.yaml
    interval: 86400


rules:
  - PROCESS-NAME,code,PROXY
  - PROCESS-NAME,ssh,PROXY
  - RULE-SET,applications,DIRECT

Mihomo log

journalctl -u mihomo -o cat -f | grep Process
DEBU[2024-01-04T20:44:45.607542894-08:00] [Process] find process ocsp.pki.goog error: process of uid(1000),inode(54165) not found
DEBU[2024-01-04T20:44:45.607603127-08:00] [Process] find process ocsp.pki.goog error: process of uid(1000),inode(54164) not found
DEBU[2024-01-04T20:47:21.104977721-08:00] [Process] find process github.com error: process of uid(1000),inode(60944) not found
DEBU[2024-01-04T20:47:26.699694229-08:00] [Process] find process github.githubassets.com error: process of uid(1000),inode(63664) not found
DEBU[2024-01-04T20:47:27.593716185-08:00] [Process] find process avatars.githubusercontent.com error: process of uid(1000),inode(62367) not found
DEBU[2024-01-04T20:47:27.609443664-08:00] [Process] find process avatars.githubusercontent.com error: process of uid(1000),inode(62368) not found
DEBU[2024-01-04T20:47:50.911174835-08:00] [Process] find process camo.githubusercontent.com error: process of uid(1000),inode(62371) not found
DEBU[2024-01-04T20:47:51.265649458-08:00] [Process] find process raw.githubusercontent.com error: process of uid(1000),inode(62372) not found
DEBU[2024-01-04T20:48:00.7150883-08:00] [Process] find process safebrowsing.googleapis.com error: process of uid(1000),inode(62373) not found
DEBU[2024-01-04T20:49:15.771765355-08:00] [Process] find process github.com error: process of uid(1000),inode(63676) not found
DEBU[2024-01-04T20:50:15.137282534-08:00] [Process] find process github.com error: process of uid(1000),inode(60961) not found
DEBU[2024-01-04T20:50:15.890696925-08:00] [Process] find process objects.githubusercontent.com error: process of uid(1000),inode(60962) not found
DEBU[2024-01-04T20:50:17.517280736-08:00] [Process] find process sb-ssl.google.com error: process of uid(1000),inode(62391) not found
DEBU[2024-01-04T20:50:17.784132214-08:00] [Process] find process ocsp.pki.goog error: process of uid(1000),inode(70446) not found
DEBU[2024-01-04T20:50:19.331875231-08:00] [Process] find process sb-ssl.google.com error: process of uid(1000),inode(70447) not found

Description

process of uid(1000),inode(xxxx) not found

When starting with systemd, there will be a bug that the process name cannot be found.

Exactly what is expected when executing the command manually:

sudo /usr/local/bin/mihomo -d /etc/mihomo
ssh root@example.com
INFO[2024-01-04T21:35:34.972091608-08:00] [TCP] 198.18.0.1:49426(ssh, uid=1000) --> example.com:22 match Process(ssh) using PROXY

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions