Systemd 怪异:无法添加依赖项,文件存在

Systemd 怪异:无法添加依赖项,文件存在

我有一台运行 wheezy 的 Debian armel 机器,今天升级到 Debian 测试版。正如你从标题中可以猜到的,systemd 在两个方面很奇怪:

1) 启动时,出现一系列错误“无法将依赖项 X 添加到 Y.target,忽略:文件存在”,但系统似乎正常启动。错误是:

Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency -.mount to local-fs.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-journald.service to sysinit.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency udev.service to basic.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-journald-dev-log.socket to sockets.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency udev-control.socket to sockets.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency udev-kernel.socket to sockets.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-journald.socket to sockets.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-journald-audit.socket to sockets.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to graphical.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency rsyslog.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency remote-fs.target to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency dbus.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-user-sessions.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency org.freedesktop.login1.busname to busnames.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency rsyslog.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency ssh.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency remote-fs.target to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency cron.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency rc-local.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency dbus.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-user-sessions.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-ask-password-wall.path to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-logind.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency getty.target to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency rsyslog.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency ssh.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency remote-fs.target to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency cron.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency rc-local.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency dbus.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-user-sessions.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-ask-password-wall.path to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-logind.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency getty.target to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to multi-user.target, ignoring: File exists
Oct 20 17:19:42 gw-16b1 systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to rescue.target, ignoring: File exists

2) 默认情况下不再启动看门狗,这会导致硬件看门狗(由引导加载程序初始化,如果没有 JTAG 访问,我不会刷新)重置系统。尝试使用“systemctl -f enable watchdog”启用它会产生以下错误:

Synchronizing state of watchdog.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable watchdog
insserv: warning: current start runlevel(s) (2 3 4 5 S) of script `watchdog' overrides LSB defaults (2 3 4 5).
[ 3269.248986] systemd[1]: Cannot add dependency cron.service to multi-user.target, ignoring: File exists
[ 3269.279002] systemd[1]: Cannot add dependency systemd-user-sessions.service to multi-user.target, ignoring: File exists
[ 3269.309118] systemd[1]: Cannot add dependency getty.target to multi-user.target, ignoring: File exists
insserv: warning: current start runlevel(s) (2 3 4 5 S) of script `watchdog' overrides LSB defaults (2 3 4 5).
[ 3273.549003] systemd[1]: Cannot add dependency rc-local.service to multi-user.target, ignoring: File exists
[ 3273.579012] systemd[1]: Cannot add dependency systemd-ask-password-wall.path to multi-user.target, ignoring: File exists
[ 3276.708974] systemd[1]: Cannot add dependency rc-local.service to multi-user.target, ignoring: File exists
[ 3276.738972] systemd[1]: Cannot add dependency systemd-ask-password-wall.path to multi-user.target, ignoring: File exists
[ 3276.768990] systemd[1]: Cannot add dependency systemd-update-utmp-runlevel.service to multi-user.target, ignoring: File exists
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

3) 显然,RTC 的某些东西也很奇怪,因为自从升级以来root 1 22.3 1.2 6372 3184 ? Ss 18:16 0:15 /sbin/init fixrtc,尽管 RTC 和 ntpdate 都正常工作,但进程仍然处于启动状态。

如何消除所有 systemd 警告并让看门狗自动启动?一个简单的service watchdog start就可以了,所以这肯定是一个systemd问题。

答案1

这意味着所有列出的工具/包的 systemd 服务文件都丢失了。您需要找到 toolname.service 文件并将其放入 /lib/systemd/system 中。

简而言之,您的 systemd 服务命令不适用于系统在引导期间警告的工具。我建议您备份数据并执行全新安装,因为升级搞砸了。

相关内容