systemctl 状态显示:“状态:降级”

systemctl 状态显示:“状态:降级”

当我奔跑时systemctl status,我到达State: degraded顶峰,

● x230
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Wed 2018-05-30 17:09:49 CDT; 3 days ago
  ....

这是怎么回事?我该如何解决?

答案1

这意味着您的某些服务无法启动。如果你systemctl;在没有参数的情况下运行,你可以看到它们status

他们应该表现出类似的东西,

loaded failed failed

或者您可以只列出失败的服务systemctl --failed,在我的例子中它显示

  UNIT                        LOAD   ACTIVE SUB    DESCRIPTION                [email protected] loaded failed failed PostgreSQL Cluster 9.4-main

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.

通常,您需要使用 来阅读日志/日志,以找出下一步对该失败项目采取的操作journalctl -xe。如果您只想重置单位以便系统running用绿点“说”,您可以运行:

systemctl reset-failed

答案2

您还可以尝试:

sudo systemctl reset-failed

systemd Reset failed 正在清除失败的单元。您可以使用 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.

答案3

列出失败的单位/服务

$ systemctl --failed

  UNIT            LOAD   ACTIVE SUB    DESCRIPTION<br>
● ipmievd.service loaded failed failed Ipmievd Daemon<br>
● kdump.service   loaded failed failed Crash recovery kernel arming

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

2 loaded units listed. Pass --all to see loaded but inactive units, too.<br>
To show all installed unit files use 'systemctl list-unit-files'.

答案4

查找失败原因:

sudo systemctl status <service>

(替换<service>为失败服务的名称)。您会找到很多有关该服务的信息,以及失败的原因。

相关内容