Ubuntu 16.04 正在以降级模式运行

Ubuntu 16.04 正在以降级模式运行

我最近从 14.04 更新到了 16.04。我的服务器上有 apache2,但最近我注意到了这一点:

fmf@kodi:~$ systemctl is-system-running
degraded
fmf@kodi:~$

因此我稍微挖掘一下:

fmf@kodi:~$ systemctl --state=failed
  UNIT            LOAD   ACTIVE SUB    DESCRIPTION
● apache2.service loaded failed failed LSB: Apache2 web server

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
fmf@kodi:~$

然后再深入挖掘一下:

fmf@kodi:~$ systemctl status -l apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Wed 2016-08-03 14:57:11 CEST; 7min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3120 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
   CGroup: /system.slice/apache2.service
           ├─3476 /usr/sbin/apache2 -k start
           ├─3479 /usr/sbin/apache2 -k start
           ├─3941 /usr/sbin/apache2 -k start
           ├─3942 /usr/sbin/apache2 -k start
           ├─3943 /usr/sbin/apache2 -k start
           ├─3944 /usr/sbin/apache2 -k start
           ├─3945 /usr/sbin/apache2 -k start
           ├─3965 /usr/sbin/apache2 -k start
           ├─3984 /usr/sbin/apache2 -k start
           └─3985 /usr/sbin/apache2 -k start

Aug 03 14:56:38 kodi systemd[1]: Starting LSB: Apache2 web server...
Aug 03 14:56:38 kodi apache2[3120]:  * Starting Apache httpd web server apache2
Aug 03 14:57:11 kodi apache2[3120]:  *
Aug 03 14:57:11 kodi apache2[3120]:  * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Aug 03 14:57:11 kodi systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 03 14:57:11 kodi systemd[1]: Failed to start LSB: Apache2 web server.
Aug 03 14:57:11 kodi systemd[1]: apache2.service: Unit entered failed state.
Aug 03 14:57:11 kodi systemd[1]: apache2.service: Failed with result 'exit-code'.
fmf@kodi:~$

奇怪的是,如果我尝试连接到服务器上的网页,我可以看到它。这个错误来自哪里?我尝试检查 apache2 日志,但没有发现任何奇怪的东西。

也许这有帮助:

fmf@kodi:~$ netstat -antp | grep 80
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3929/kodi.bin
tcp        0      1 192.168.254.8:47306     144.76.30.184:80        SYN_SENT    3929/kodi.bin
tcp        0    160 192.168.254.8:46574     144.76.30.184:80        ESTABLISHED 3929/kodi.bin
tcp        0    156 192.168.254.8:46836     144.76.30.184:80        ESTABLISHED 3929/kodi.bin
tcp        0    165 192.168.254.8:47268     144.76.30.184:80        ESTABLISHED 3929/kodi.bin
tcp        0    166 192.168.254.8:47232     144.76.30.184:80        FIN_WAIT1   -
tcp        0    165 192.168.254.8:47112     144.76.30.184:80        ESTABLISHED 3929/kodi.bin
tcp        0      1 192.168.254.8:47304     144.76.30.184:80        SYN_SENT    3929/kodi.bin
tcp        0      1 192.168.254.8:47302     144.76.30.184:80        SYN_SENT    3929/kodi.bin
tcp        1      0 192.168.254.8:38502     104.20.56.43:80         CLOSE_WAIT  3176/python
tcp        0      1 192.168.254.8:47292     144.76.30.184:80        SYN_SENT    3929/kodi.bin
tcp        0    166 192.168.254.8:47252     144.76.30.184:80        FIN_WAIT1   -
tcp        0      1 192.168.254.8:47294     144.76.30.184:80        SYN_SENT    3929/kodi.bin
tcp6       0      0 :::8080                 :::*                    LISTEN      3929/kodi.bin
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 192.168.254.8:80        77.108.48.106:61805     TIME_WAIT   -
tcp6       0      0 192.168.254.8:80        77.108.48.106:61851     TIME_WAIT   -
fmf@kodi:~$

请问有什么帮助吗?

答案1

您也可以尝试:

sudo systemctl reset-failed

reset-failed [PATTERN...]
           Reset the "failed" state of the specified units, or if no unit name is passed, reset the state of all units. When a unit
           fails in some way (i.e. process exiting with non-zero error code, terminating abnormally or timing out), it will
           automatically enter the "failed" state and its exit code and status is recorded for introspection by the administrator
           until the service is stopped/re-started or reset with this command.

           In addition to resetting the "failed" state of a unit it also resets various other per-unit properties: the start rate
           limit counter of all unit types is reset to zero, as is the restart counter of service units. Thus, if a unit's start
           limit (as configured with StartLimitIntervalSec=/StartLimitBurst=) is hit and the unit refuses to be started again, use
           this command to make it startable again.

相关内容