问题描述
我想确定为什么 systemd-timesyncd
拒绝在启动时启动而不在 systemctl status
中记录任何内容或提供有用的信息。
# systemctl status systemd-timesyncd
* systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
可以采取哪些步骤来确定一般情况下的问题?
解决方法
在阅读了大量优秀的人文件并将服务的重复版本一分为二(它总是“神秘地工作”,回想起来并不神秘)之后。
我发现有一个带有 Conficts=... systemd-timesyncd.service
的未提及的 vboxadd-service.service
。
日志中没有任何提示(根据 https://github.com/systemd/systemd/issues/7104,大概 systemd.log_level=debug
会在这里有所帮助)。
我只能通过检查
的输出来注意到冲突systemd-analyze dot systemd-timesyncd.service
提供了冲突的暗示。
通常,您可以使用
列出所有冲突的服务# systemd-analyze dot systemd-timesyncd.service 2>/dev/null | grep red
"systemd-timesyncd.service"->"shutdown.target" [color="red"];
"vboxadd-service.service"->"systemd-timesyncd.service" [color="red"];
或类似的命令
# systemctl show '*' -p Id,Conflicts | grep -B1 '^Conflicts=.*systemd-timesyncd' | sed -n 's/^Id=//p'
vboxadd-service.service