自几周以来,当我的服务器(Ubuntu 20.04LTS)重新启动时,openvpnas
无法正确启动并在日志中留下如下消息openvpnas
。
2024-04-22T05:04:11+0200 [stdout#info] Server Agent initialization status:
2024-04-22T05:04:11+0200 [stdout#info] {
2024-04-22T05:04:11+0200 [stdout#info] "errors": {
2024-04-22T05:04:11+0200 [stdout#info] "iptables_web": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "error",
2024-04-22T05:04:11+0200 [stdout#info] "service failed to start due to unresolved dependencies: {'web'}"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_0": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "info",
2024-04-22T05:04:11+0200 [stdout#info] "process started successfully on 172.27.224.1"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_1": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "info",
2024-04-22T05:04:11+0200 [stdout#info] "process started successfully on 172.27.228.1"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_2": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "info",
2024-04-22T05:04:11+0200 [stdout#info] "process started successfully on 172.27.232.1"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_3": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "info",
2024-04-22T05:04:11+0200 [stdout#info] "process started successfully on 172.27.236.1"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] "web": [
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "error",
2024-04-22T05:04:11+0200 [stdout#info] "process started but is unresponsive: "
2024-04-22T05:04:11+0200 [stdout#info] ],
2024-04-22T05:04:11+0200 [stdout#info] [
2024-04-22T05:04:11+0200 [stdout#info] "error",
2024-04-22T05:04:11+0200 [stdout#info] "service failed to start or returned error status"
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] ]
2024-04-22T05:04:11+0200 [stdout#info] },
2024-04-22T05:04:11+0200 [stdout#info] "last_restarted": "Mon Apr 22 05:02:37 2024",
2024-04-22T05:04:11+0200 [stdout#info] "service_status": {
2024-04-22T05:04:11+0200 [stdout#info] "api": "started",
2024-04-22T05:04:11+0200 [stdout#info] "auth": "started",
2024-04-22T05:04:11+0200 [stdout#info] "bridge": "started",
2024-04-22T05:04:11+0200 [stdout#info] "client_query": "started",
2024-04-22T05:04:11+0200 [stdout#info] "crl": "started",
2024-04-22T05:04:11+0200 [stdout#info] "daemon_pre": "started",
2024-04-22T05:04:11+0200 [stdout#info] "db_push": "started",
2024-04-22T05:04:11+0200 [stdout#info] "ip6tables_live": "started",
2024-04-22T05:04:11+0200 [stdout#info] "ip6tables_openvpn": "started",
2024-04-22T05:04:11+0200 [stdout#info] "iptables_api": "started",
2024-04-22T05:04:11+0200 [stdout#info] "iptables_live": "started",
2024-04-22T05:04:11+0200 [stdout#info] "iptables_openvpn": "started",
2024-04-22T05:04:11+0200 [stdout#info] "iptables_web": "off. Error: [Error: service failed to start due to unresolved dependencies: {'web'}.]",
2024-04-22T05:04:11+0200 [stdout#info] "log": "started",
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_0": "started",
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_1": "started",
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_2": "started",
2024-04-22T05:04:11+0200 [stdout#info] "openvpn_3": "started",
2024-04-22T05:04:11+0200 [stdout#info] "subscription": "started",
2024-04-22T05:04:11+0200 [stdout#info] "user": "started",
2024-04-22T05:04:11+0200 [stdout#info] "web": "off. Error: [Error: service failed to start or returned error status.]"
2024-04-22T05:04:11+0200 [stdout#info] }
2024-04-22T05:04:11+0200 [stdout#info] }
但是,如果我稍后重新启动它,一切都会正常运行,不会出现错误。我该怎么做才能防止这种情况发生?现在,我restart
在 cron 中输入了一个命令,但这并不理想。
2024-04-22T07:00:39+0200 [stdout#info] "service_status": {
2024-04-22T07:00:39+0200 [stdout#info] "api": "started",
2024-04-22T07:00:39+0200 [stdout#info] "auth": "started",
2024-04-22T07:00:39+0200 [stdout#info] "bridge": "started",
2024-04-22T07:00:39+0200 [stdout#info] "client_query": "started",
2024-04-22T07:00:39+0200 [stdout#info] "crl": "started",
2024-04-22T07:00:39+0200 [stdout#info] "daemon_pre": "started",
2024-04-22T07:00:39+0200 [stdout#info] "db_push": "started",
2024-04-22T07:00:39+0200 [stdout#info] "ip6tables_live": "started",
2024-04-22T07:00:39+0200 [stdout#info] "ip6tables_openvpn": "started",
2024-04-22T07:00:39+0200 [stdout#info] "iptables_api": "started",
2024-04-22T07:00:39+0200 [stdout#info] "iptables_live": "started",
2024-04-22T07:00:39+0200 [stdout#info] "iptables_openvpn": "started",
2024-04-22T07:00:39+0200 [stdout#info] "iptables_web": "started",
2024-04-22T07:00:39+0200 [stdout#info] "log": "started",
2024-04-22T07:00:39+0200 [stdout#info] "openvpn_0": "started",
2024-04-22T07:00:39+0200 [stdout#info] "openvpn_1": "started",
2024-04-22T07:00:39+0200 [stdout#info] "openvpn_2": "started",
2024-04-22T07:00:39+0200 [stdout#info] "openvpn_3": "started",
2024-04-22T07:00:39+0200 [stdout#info] "subscription": "started",
2024-04-22T07:00:39+0200 [stdout#info] "user": "started",
2024-04-22T07:00:39+0200 [stdout#info] "web": "started"
2024-04-22T07:00:39+0200 [stdout#info] }
2024-04-22T07:00:39+0200 [stdout#info] }
答案1
首先使用以下命令检查 openvpn 服务启动后的状态:
systemctl list-units --type=service
如果尚未激活并运行,请按照此处的说明操作:
如何配置服务以在启动时运行