Skip to content
Discussion options

You must be logged in to vote

Solution

systemd user service 的 PATH 环境变量不包含 ~/.local/bin,导致找不到 hermes 二进制。

修复步骤

# 1. 编辑 service 文件,添加 PATH 环境变量
systemctl --user edit hermes-web-ui.service

# 在打开的编辑器中添加:
[Service]
Environment=PATH=/home/tony/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# 2. 重载 systemd 并重启
systemctl --user daemon-reload
systemctl --user restart hermes-web-ui

# 3. 验证状态
systemctl --user status hermes-web-ui

为什么这样解决

systemd 的 user service 默认 PATH 很精简(/usr/bin:/bin),不会读取 shell 的 profile/rc 文件。而 hermes 二进制安装在 ~/.local/bin/,不在默认 PATH 中。所以从终端手动运行正常,但通过 systemd 启动就报 ENOENT。

验证

# 确认 service 运行正常
systemctl --user is-active hermes-web-ui
# 应输出:active

# 查看日志确认无 ENOENT 错误
journalctl --us…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by normdist-ai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant