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

Eva*_*oll 88 systemd

当我跑步时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
  ....
Run Code Online (Sandbox Code Playgroud)

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

Eva*_*oll 111

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

他们应该显示类似的东西,

loaded failed failed
Run Code Online (Sandbox Code Playgroud)

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

  UNIT                        LOAD   ACTIVE SUB    DESCRIPTION                
? postgresql@9.4-main.service 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.
Run Code Online (Sandbox Code Playgroud)

通常,您需要使用journalctl -xe. 如果您只想重置单位以便系统running用绿点“说” ,您可以运行:

systemctl reset-failed
Run Code Online (Sandbox Code Playgroud)

  • 从未尝试过在没有状态或其他参数的情况下运行 systemctl。你改变了我的生活。 (5认同)

Bra*_*son 23

您也可以尝试:

sudo systemctl reset-failed
Run Code Online (Sandbox Code Playgroud)

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.
Run Code Online (Sandbox Code Playgroud)

  • 对这个命令的作用的更多解释会很好。后果是什么?是否有数据丢失等风险。 (10认同)

小智 13

列出失败的单位/服务

$ systemctl --失败

单元负载活动子描述
? ipmievd.service 加载失败失败 Ipmievd 守护进程
?kdump.service 加载失败失败崩溃恢复内核武装

LOAD = 反映单元定义是否正确加载。
ACTIVE = 高级单元激活状态,即 SUB 的泛化。
SUB = 低级单元激活状态,值取决于单元类型。

列出了 2 个加载单元。通过 --all 也可以查看已加载但不活动的单位。
要显示所有已安装的单元文件,请使用“systemctl list-unit-files”。


小智 7

更简洁地回答原来的问题:

systemctl | grep fail

  • 为了使其成为一个实际的答案,您可能应该解释它的作用以及他们应该在此命令的输出中查看什么(最好带有示例)。 (6认同)