查看我的系统日志,我在以下位置看到以下消息/var/log/messages
:
Sep 2 15:29:15 <myhostname> systemd[1]: Requested transaction contradicts existing jobs: File exists
所以,我的问题是:如何解决此错误?我应该采取哪些步骤来了解这意味着什么、造成这种情况的原因、是否值得担心,如果是,如何纠正?
并且,“请求的事务与现有作业相矛盾”消息的含义是什么?我怀疑我一定缺少概念背景。无论如何,此错误消息是否建议某些候选者采取后续步骤来诊断此错误消息的原因并了解导致该错误消息的原因?
我已阅读 systemd 文档,但我发现它们对此没有帮助。最好有一个关于寻找什么的一般指南:我怀疑这可能对那些也经历过“……与现有工作相矛盾”信息的其他人有帮助。
答案1
要获取有关此错误的更多信息以进行故障排除,请首先运行以下命令:
$ journalctl -ab
这将从 systemd 日志中转储一些详细日志。
此外,在该错误的正前方可能还有另一个错误,告诉您具体是哪项服务出现了问题。也尝试诊断该服务(以firewalld为例):
$ systemctl status firewalld.service
具体来说,该行来自用于事务激活的 systemd 代码:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=75778e21dfeee51036d24501e39ea7398fabe502
具体来说,对于 systemd 事务(来自 man systemd):
systemd has a minimal transaction system: if a unit is requested to start up
or shut down it will add it and all its dependencies to a temporary
transaction. Then, it will verify if the transaction is consistent (i.e.
whether the ordering of all units is cycle-free). If it is not, systemd will
try to fix it up, and removes non-essential jobs from the transaction that
might remove the loop. Also, systemd tries to suppress non-essential jobs in
the transaction that would stop a running service. Finally it is checked
whether the jobs of the transaction contradict jobs that have already been
queued, and optionally the transaction is aborted then. If all worked out and
the transaction is consistent and minimized in its impact it is merged with
all already outstanding jobs and added to the run queue. Effectively this
means that before executing a requested operation, systemd will verify that
it makes sense, fixing it if possible, and only failing if it really cannot
work.
因此,将所有这些结合在一起,我猜测在该日志条目附近还有其他东西正在尝试启动,但已经有一个锁定文件(可能已过时)需要清理。