seagullz4 / hysteria2

hysteria2一键安装精简版/hy2一键安装/hysteria2 install/نصب با یک کلیک hysteria2/祝大家万事如意,心想事成
619 stars 63 forks source link

更新无法正常恢复服务 #20

Closed livingfree2023 closed 3 months ago

livingfree2023 commented 5 months ago

最近的hy更新,使用脚本更新功能后,服务异常,需要手动kill后再启动服务才能正常。怀疑结束进程的代码没有执行?

log如下: 选择一个操作,小崽子(ง ื▿ ื)ว:

  1. 安装(以梦为马)
  2. 卸载(以心为疆)
  3. 查看配置(穿越时空)
  4. 退出脚本(回到未来)
  5. 在线更新hy2内核(您当前的hy2版本:v2.2.4) hy2究极版本v24.01.01

    hysteria2状态: 运行中 输入操作编号 (1/2/3/4/5): 5 正在更新中,别急,老登 更新完成,老登

root @ tokyo-amd in ~ [9:52:03] C:130

$ service hysteria status × hysteria.service - My Hysteria Server Loaded: loaded (/etc/systemd/system/hysteria.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2024-03-25 09:51:53 HKT; 20s ago Process: 3899388 ExecStart=/root/hy3/hysteria-linux-amd64 server (code=exited, status=203/EXEC) Main PID: 3899388 (code=exited, status=203/EXEC) CPU: 1ms

Mar 25 09:51:53 tokyo-amd systemd[3899388]: hysteria.service: Failed at step EXEC spawning /root/hy3/hy> Mar 25 09:51:53 tokyo-amd systemd[1]: Started My Hysteria Server. Mar 25 09:51:53 tokyo-amd systemd[1]: hysteria.service: Main process exited, code=exited, status=203/EX> Mar 25 09:51:53 tokyo-amd systemd[1]: hysteria.service: Failed with result 'exit-code'. Mar 25 09:51:53 tokyo-amd systemd[1]: hysteria.service: Scheduled restart job, restart counter is at 7. Mar 25 09:51:53 tokyo-amd systemd[1]: Stopped My Hysteria Server. Mar 25 09:51:53 tokyo-amd systemd[1]: hysteria.service: Start request repeated too quickly. Mar 25 09:51:53 tokyo-amd systemd[1]: hysteria.service: Failed with result 'exit-code'. Mar 25 09:51:53 tokyo-amd systemd[1]: Failed to start My Hysteria Server.

seagullz4 commented 5 months ago

建议执行最新版的脚本

livingfree2023 commented 5 months ago

建议执行最新版的脚本

没有降级,直接再试了一下,服务正常的情况下执行升级的结果是服务状态变成failed了

# root @ tokyo-amd in ~ [8:57:06]
$ curl -sSL https://github.com/seagullz4/hysteria2/raw/main/install.sh -o install.sh && chmod +x install.sh && bash install.sh
安装必要依赖中......
依赖安装完成

░██  ░██
░██  ░██       ░████        ░█         ░█        ░█░█░█
░██  ░██     ░█      █      ░█         ░█        ░█    ░█
░██████     ░██████         ░█         ░█        ░█    ░█
░██  ░██     ░█             ░█ ░█      ░█  ░█     ░█░█░█
░██  ░██      ░██  █         ░█         ░█

人生有两出悲剧:一是万念俱灰,另一是踌躇满志
选择一个操作,小崽子(ง ื▿ ื)ว:
1. 安装(以梦为马)
2. 卸载(以心为疆)
>>>>>>>>>>>>>>>>>>>>
3. 查看配置(穿越时空)
4. 退出脚本(回到未来)
>>>>>>>>>>>>>>>>>>>>
5. 在线更新hy2内核(您当前的hy2版本:v2.4.0)
6. 安装xanmod内核(更好的调动网络资源)
hy2内核最新版本为: v2.4.0
>>>>>>>>>>>>>>>>>>>>
hysteria2状态: 运行中
输入操作编号 (1/2/3/4/5): 5
正在更新中,别急,老登
更新完成,老登
您当前的更新后hy2版本:v2.4.0

# root @ tokyo-amd in ~ [8:57:38]
$ service hysteria  status
× hysteria.service - My Hysteria Server
     Loaded: loaded (/etc/systemd/system/hysteria.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-03-29 08:56:10 HKT; 1min 33s ago
    Process: 3445296 ExecStart=/root/hy3/hysteria-linux-amd64 server (code=exited, status=1/FAILURE)
   Main PID: 3445296 (code=exited, status=1/FAILURE)
        CPU: 7ms

Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Scheduled restart job, restart counter is at 6.
Mar 29 08:56:10 tokyo-amd systemd[1]: Stopped My Hysteria Server.
Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Start request repeated too quickly.
Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Failed with result 'exit-code'.
Mar 29 08:56:10 tokyo-amd systemd[1]: Failed to start My Hysteria Server.

我发现虽然服务是failed,但是节点是可以使用的,于是ps了一下,看到起了一个新的进程

# root @ tokyo-amd in ~ [9:05:18]
$ ps -elf |grep hysteria
4 S root     3447350       1  0  80   0 - 310500 ep_pol 08:57 pts/1   00:00:01 ./hysteria-linux-amd64 server
0 S root     3457683 3898649  0  80   0 -  1653 pipe_r 09:05 pts/1    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox hysteria

# root @ tokyo-amd in ~ [9:05:38]
$ ps -p 3447350 -o lstart=
Fri Mar 29 08:57:38 2024

时间上看是刚刚执行update后启动的,这个进程导致了hysteria service无法启动,如果kill这个进程后restart service就一切正常了

$ killall -9 hysteria-linux-amd64

# root @ tokyo-amd in ~ [9:06:52]
$ systemctl restart hysteria

# root @ tokyo-amd in ~ [9:06:56]
$ service hysteria  status
● hysteria.service - My Hysteria Server
     Loaded: loaded (/etc/systemd/system/hysteria.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-03-29 09:06:55 HKT; 5s ago
   Main PID: 3459266 (hysteria-linux-)
      Tasks: 5 (limit: 1038)
     Memory: 6.6M
        CPU: 123ms
     CGroup: /system.slice/hysteria.service
             └─3459266 /root/hy3/hysteria-linux-amd64 server

Mar 29 09:06:55 tokyo-amd systemd[1]: Started My Hysteria Server.
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        server mode
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        maintenance        started background cer>
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        server up and running        {"listen": ">
lines 1-14/14 (END)

修改建议:如果把updatehy2 ()里面的kill和nohup启动代码改成systemctl stop hysteria.servicesystemctl start hysteria.service就都正常了

seagullz4 commented 5 months ago

建议执行最新版的脚本

没有降级,直接再试了一下,服务正常的情况下执行升级的结果是服务状态变成failed了

# root @ tokyo-amd in ~ [8:57:06]
$ curl -sSL https://github.com/seagullz4/hysteria2/raw/main/install.sh -o install.sh && chmod +x install.sh && bash install.sh
安装必要依赖中......
依赖安装完成

░██  ░██
░██  ░██       ░████        ░█         ░█        ░█░█░█
░██  ░██     ░█      █      ░█         ░█        ░█    ░█
░██████     ░██████         ░█         ░█        ░█    ░█
░██  ░██     ░█             ░█ ░█      ░█  ░█     ░█░█░█
░██  ░██      ░██  █         ░█         ░█

人生有两出悲剧:一是万念俱灰,另一是踌躇满志
选择一个操作,小崽子(ง ื▿ ื)ว:
1. 安装(以梦为马)
2. 卸载(以心为疆)
>>>>>>>>>>>>>>>>>>>>
3. 查看配置(穿越时空)
4. 退出脚本(回到未来)
>>>>>>>>>>>>>>>>>>>>
5. 在线更新hy2内核(您当前的hy2版本:v2.4.0)
6. 安装xanmod内核(更好的调动网络资源)
hy2内核最新版本为: v2.4.0
>>>>>>>>>>>>>>>>>>>>
hysteria2状态: 运行中
输入操作编号 (1/2/3/4/5): 5
正在更新中,别急,老登
更新完成,老登
您当前的更新后hy2版本:v2.4.0

# root @ tokyo-amd in ~ [8:57:38]
$ service hysteria  status
× hysteria.service - My Hysteria Server
     Loaded: loaded (/etc/systemd/system/hysteria.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-03-29 08:56:10 HKT; 1min 33s ago
    Process: 3445296 ExecStart=/root/hy3/hysteria-linux-amd64 server (code=exited, status=1/FAILURE)
   Main PID: 3445296 (code=exited, status=1/FAILURE)
        CPU: 7ms

Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Scheduled restart job, restart counter is at 6.
Mar 29 08:56:10 tokyo-amd systemd[1]: Stopped My Hysteria Server.
Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Start request repeated too quickly.
Mar 29 08:56:10 tokyo-amd systemd[1]: hysteria.service: Failed with result 'exit-code'.
Mar 29 08:56:10 tokyo-amd systemd[1]: Failed to start My Hysteria Server.

我发现虽然服务是failed,但是节点是可以使用的,于是ps了一下,看到起了一个新的进程

# root @ tokyo-amd in ~ [9:05:18]
$ ps -elf |grep hysteria
4 S root     3447350       1  0  80   0 - 310500 ep_pol 08:57 pts/1   00:00:01 ./hysteria-linux-amd64 server
0 S root     3457683 3898649  0  80   0 -  1653 pipe_r 09:05 pts/1    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox hysteria

# root @ tokyo-amd in ~ [9:05:38]
$ ps -p 3447350 -o lstart=
Fri Mar 29 08:57:38 2024

时间上看是刚刚执行update后启动的,这个进程导致了hysteria service无法启动,如果kill这个进程后restart service就一切正常了

$ killall -9 hysteria-linux-amd64

# root @ tokyo-amd in ~ [9:06:52]
$ systemctl restart hysteria

# root @ tokyo-amd in ~ [9:06:56]
$ service hysteria  status
● hysteria.service - My Hysteria Server
     Loaded: loaded (/etc/systemd/system/hysteria.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-03-29 09:06:55 HKT; 5s ago
   Main PID: 3459266 (hysteria-linux-)
      Tasks: 5 (limit: 1038)
     Memory: 6.6M
        CPU: 123ms
     CGroup: /system.slice/hysteria.service
             └─3459266 /root/hy3/hysteria-linux-amd64 server

Mar 29 09:06:55 tokyo-amd systemd[1]: Started My Hysteria Server.
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        server mode
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        maintenance        started background cer>
Mar 29 09:06:55 tokyo-amd hysteria-linux-amd64[3459266]: 2024-03-29T09:06:55+08:00        INFO        server up and running        {"listen": ">
lines 1-14/14 (END)

修改建议:如果把updatehy2 ()里面的kill和nohup启动代码改成systemctl stop hysteria.servicesystemctl start hysteria.service就都正常了

很感谢建议,后续有空将会继续优化