apernet / hysteria

Hysteria is a powerful, lightning fast and censorship resistant proxy.
https://v2.hysteria.network/
MIT License
15.18k stars 1.69k forks source link

Hysteria 2 一键脚本 服务器无法启动 #1252

Closed vipnet2021 closed 2 weeks ago

vipnet2021 commented 2 weeks ago

执行命令:systemctl status hysteria-server.service 以下运行命令错误提示: hysteria-server.service - Hysteria Server Service (config.yaml) Loaded: loaded (/etc/systemd/system/hysteria-server.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Thu 2024-11-14 21:09:52 CST; 15s ago Duration: 14ms Process: 36022 ExecStart=/usr/local/bin/hysteria server --config /etc/hysteria/config.yaml (code=exited, status=1/FAILURE) Main PID: 36022 (code=exited, status=1/FAILURE) CPU: 10ms

Nov 14 21:09:52 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 21:09:52 instance-20241109-1656 hysteria[36022]: 2024-11-14T21:09:52+08:00 INFO server mode Nov 14 21:09:52 instance-20241109-1656 hysteria[36022]: 2024-11-14T21:09:52+08:00 FATAL failed to load server config> Nov 14 21:09:52 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 21:09:52 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. lines 1-13/13 (END)

VPS服务商:oracle.com

服务器配置文件 config.zip

以上请协助

vipnet2021 commented 2 weeks ago

更换VPS商安装启动无任何异常,是不是Oracle.com运行商限制了什么?

haruue commented 2 weeks ago

您好。

您提供的配置没有问题。

另外, 要检查服务端日志, 请使用下面这个命令。 你使用的命令会导致输出被截断, 从而错过关键错误输出。

journalctl --no-pager -e -u hysteria-server.service

要确认服务端的配置文件, 请先 SSH 登录无法启动 Hysteria 服务端的服务器, 然后执行以下命令, 并复制输出发到这里。

cat /etc/hysteria/config.yaml
vipnet2021 commented 2 weeks ago

执行命令:journalctl --no-pager -e -u hysteria-server.service Nov 14 20:20:25 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 20:20:25 instance-20241109-1656 hysteria[17071]: 2024-11-14T20:20:25+08:00 INFO server mode Nov 14 20:20:25 instance-20241109-1656 hysteria[17071]: 2024-11-14T20:20:25+08:00 FATAL failed to load server config {"error": "invalid config: tls: must set either tls or acme"} Nov 14 20:20:25 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 20:20:25 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. Nov 14 21:08:56 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 21:08:56 instance-20241109-1656 hysteria[35645]: 2024-11-14T21:08:56+08:00 INFO server mode Nov 14 21:08:56 instance-20241109-1656 hysteria[35645]: 2024-11-14T21:08:56+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"} Nov 14 21:08:56 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 21:08:56 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. Nov 14 21:09:28 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 21:09:28 instance-20241109-1656 hysteria[35965]: 2024-11-14T21:09:28+08:00 INFO server mode Nov 14 21:09:28 instance-20241109-1656 hysteria[35965]: 2024-11-14T21:09:28+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"} Nov 14 21:09:28 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 21:09:28 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. Nov 14 21:09:52 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 21:09:52 instance-20241109-1656 hysteria[36022]: 2024-11-14T21:09:52+08:00 INFO server mode Nov 14 21:09:52 instance-20241109-1656 hysteria[36022]: 2024-11-14T21:09:52+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"} Nov 14 21:09:52 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 21:09:52 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. Nov 14 22:20:03 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 22:20:04 instance-20241109-1656 hysteria[61303]: 2024-11-14T22:20:04+08:00 INFO server mode Nov 14 22:20:04 instance-20241109-1656 hysteria[61303]: 2024-11-14T22:20:04+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"} Nov 14 22:20:04 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 22:20:04 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. Nov 14 22:23:31 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 22:23:31 instance-20241109-1656 hysteria[62467]: 2024-11-14T22:23:31+08:00 INFO server mode Nov 14 22:23:31 instance-20241109-1656 hysteria[62467]: 2024-11-14T22:23:31+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"} Nov 14 22:23:31 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 22:23:31 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'.

执行命令:cat /etc/hysteria/config.yaml listen: :443 #监听端口

使用CA证书

acme:

domains:

- a.com #你的域名,需要先解析到服务器ip

email: @.***

使用自签证书

tls: cert: /etc/hysteria/server.crt key: /etc/hysteria/server.key auth: type: password password: hltgJTxhkSwa masquerade: type: proxy proxy: url: https://bing.com rewriteHost: true

重启:systemctl restart hysteria-server.service 查询服务状态 :systemctl status hysteria-server.service

错误依旧如此: × hysteria-server.service - Hysteria Server Service (config.yaml) Loaded: loaded (/etc/systemd/system/hysteria-server.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Thu 2024-11-14 22:30:12 CST; 11s ago Duration: 87ms Process: 1295 ExecStart=/usr/local/bin/hysteria server --config /etc/hysteria/config.yaml (code=exited, status=1/FAILURE) Main PID: 1295 (code=exited, status=1/FAILURE) CPU: 78ms Nov 14 22:30:12 instance-20241109-1656 systemd[1]: Started hysteria-server.service - Hysteria Server Service (config.yaml). Nov 14 22:30:12 instance-20241109-1656 hysteria[1295]: 2024-11-14T22:30:12+08:00 INFO server mode Nov 14 22:30:12 instance-20241109-1656 hysteria[1295]: 2024-11-14T22:30:12+08:00 FATAL failed to load server config > Nov 14 22:30:12 instance-20241109-1656 systemd[1]: hysteria-server.service: Main process exited, code=exited, status=1/FAILURE Nov 14 22:30:12 instance-20241109-1656 systemd[1]: hysteria-server.service: Failed with result 'exit-code'. lines 1-13/13 (END) ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年11月14日 22:22 | | 收件人 | @.> | | 抄送人 | @.>, @.> | | 主题 | Re: [apernet/hysteria] Hysteria 2 一键脚本 服务器无法启动 (Issue #1252) |

您好。

您提供的配置没有问题。

另外, 要检查服务端日志, 请使用下面这个命令。 你使用的命令会导致输出被截断, 从而错过关键错误输出。

journalctl --no-pager -e -u hysteria-server.service

要确认服务端的配置文件, 请先 SSH 登录无法启动 Hysteria 服务端的服务器, 然后执行以下命令, 并复制输出发到这里。

cat /etc/hysteria/config.yaml

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

haruue commented 2 weeks ago
Nov 14 22:23:31 instance-20241109-1656 hysteria[62467]: 2024-11-14T22:23:31+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"}

这个错误意味着你的服务器上有另一个程序占用了 UDP 443 端口, 这可能是另一个 Hysteria 进程, 也可能是其它程序。

你可以使用下面这个命令确定是什么程序占用了 UDP 443 端口:

ss -lupn | grep :443
vipnet2021 commented 2 weeks ago

ss -lupn | grep :443 UNCONN 0 0 0.0.0.0:443 0.0.0.0: users:(("docker-proxy",pid=21271,fd=4)) UNCONN 0 0 [::]:443 [::]: users:(("docker-proxy",pid=21277,fd=4))

是这个占用的缘故吗?

---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年11月14日 22:38 | | 收件人 | @.> | | 抄送人 | @.>, @.> | | 主题 | Re: [apernet/hysteria] Hysteria 2 一键脚本 服务器无法启动 (Issue #1252) | Nov 14 22:23:31 instance-20241109-1656 hysteria[62467]: 2024-11-14T22:23:31+08:00 FATAL failed to load server config {"error": "invalid config: listen: listen udp :443: bind: address already in use"}

这个错误意味着你的服务器上有另一个程序占用了 UDP 443 端口, 这可能是另一个 Hysteria 进程, 也可能是其它程序。

你可以使用下面这个命令确定是什么程序占用了 UDP 443 端口:

ss -lupn | grep :443

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

haruue commented 2 weeks ago
ss -lupn | grep :443
UNCONN 0 0 0.0.0.0:443 0.0.0.0:* users:(("docker-proxy",pid=21271,fd=4))
UNCONN 0 0 [::]:443 [::]:* users:(("docker-proxy",pid=21277,fd=4))

是这个占用的缘故吗?

是的。

看起来这个进程与 docker 相关, 如果你不需要 docker, 停用并禁用 docker 通常可以让这个进程消失。

systemctl disable --now docker

如果你仍然需要 docker, 你可能需要修改 docker 设置, 或者为 Hysteria 服务端指定另一个端口(通过修改 Hysteria 服务端配置文件的 listen 选项)。

vipnet2021 commented 2 weeks ago

大神膜拜了,完美解决。443端口占用导致的原因,安装没问题了,启动OK,谢谢大神

---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年11月14日 22:51 | | 收件人 | @.> | | 抄送人 | @.>, @.> | | 主题 | Re: [apernet/hysteria] Hysteria 2 一键脚本 服务器无法启动 (Issue #1252) | ss -lupn | grep :443 UNCONN 0 0 0.0.0.0:443 0.0.0.0: users:(("docker-proxy",pid=21271,fd=4)) UNCONN 0 0 [::]:443 [::]: users:(("docker-proxy",pid=21277,fd=4))

是这个占用的缘故吗?

是的。

看起来这个进程与 docker 相关, 如果你不需要 docker, 停用并禁用 docker 通常可以让这个进程消失。

systemctl disable --now docker

如果你仍然需要 docker, 你可能需要修改 docker 设置, 或者为 Hysteria 服务端指定另一个端口(通过修改服务端配置文件的 listen 选项)。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>