type
Post
status
Published
date
May 10, 2026
slug
hermes_gateway_replace
summary
排查 Hermes Gateway 持续出现 “Gateway shutting down” 的原因。本文基于实际日志分析 systemd 与
gateway run --replace 的冲突机制,定位 Hermes install 脚本导致的循环重启问题,并给出 systemd 配置修复与 gateway 清理方案。适用于 Hermes Agent、OpenWebUI 与 AI Agent 长驻服务场景。category
技术分享
tags
Hermes
AI-Agent
icon
问题背景
使用 Hermes Gateway 时,前端持续提示:
表现为:
- Agent 对话中断
- Gateway 周期性重启
- 长任务被强制终止
问题定位
确认 Hermes Gateway 由 systemd 托管:
查看配置:
关键内容:
查看日志:
关键报错:
说明:
gateway run --replace会替换已有 gateway
- systemd 又会自动拉起新进程
- 两者互相 replace,形成循环重启
最终表现为:
本质原因
Hermes install 脚本生成的 systemd 配置存在组合问题:
其中:
-replace适合 CLI 临时替换
- 不适合作为 systemd 长驻参数
Restart=always会在正常退出后继续拉起服务
最终形成 restart loop。
解决方案
1. 修改 systemd 配置
核心修改:
最终配置:
2. 清理旧 Gateway 进程
确认:
仅剩:
3. 重新加载并启动
检查:
正常情况下:
- 不再带
-replace
- 不再出现 restart loop
修复结果
修复后:
- Hermes Gateway 可稳定常驻
- 不再周期性 shutdown
- 不再出现 task interrupted
结语
Hermes Gateway 当前仍偏早期,问题主要集中在:
- gateway 生命周期管理
- systemd integration
- replace 机制
尤其:
更适合:
- 手动调试
- CLI 临时替换
不适合作为:
长期运行。
安装完成后建议优先检查:
确认是否存在:
推荐阅读
有关Hermes安装或者使用上的问题,欢迎您在底部评论区留言,一起交流~