我正在尝试启用该watchdog
服务(在 Raspbian Jessie 上)。
我已经安装watchdog
并(希望)配置它。
sudo systemctl start watchdog
似乎启动就OK了
systemctl status watchdog.service
显示它正在运行:-
● watchdog.service - watchdog daemon
Loaded: loaded (/lib/systemd/system/watchdog.service; static)
Active: active (running) since Mon 2017-02-20 15:52:46 AEDT; 22s ago
Process: 1828 ExecStart=/bin/sh -c [ $run_watchdog != 1 ] || exec /usr/sbin/watchdog $watchdog_options (code=exited, status=0/SUCCESS)
Process: 1824 ExecStartPre=/bin/sh -c [ -z "${watchdog_module}" ] || [ "${watchdog_module}" = "none" ] || /sbin/modprobe $watchdog_module (code=exited, status=0/SUCCESS)
Main PID: 1831 (watchdog)
CGroup: /system.slice/watchdog.service
└─1831 /usr/sbin/watchdog
当我尝试启用它时,sudo systemctl enable watchdog
我得到了这个奇怪的输出
Synchronizing state for watchdog.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d watchdog defaults
Executing /usr/sbin/update-rc.d watchdog enable
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, ...).
systemctl list-units |尝试sudo update-rc.d watchdog enable
似乎都没有成功grep 看门狗
cat /lib/systemd/system/watchdog.service
确实没有 [Install] 部分
[Unit]
Description=watchdog daemon
Conflicts=wd_keepalive.service
After=multi-user.target
OnFailure=wd_keepalive.service
[Service]
Type=forking
EnvironmentFile=/etc/default/watchdog
ExecStartPre=/bin/sh -c '[ -z "${watchdog_module}" ] || [ "${watchdog_module}" = "none" ] || /sbin/modprobe $watchdog_module
ExecStart=/bin/sh -c '[ $run_watchdog != 1 ] || exec /usr/sbin/watchdog $watchdog_options'
ExecStopPost=/bin/sh -c '[ $run_wd_keepalive != 1 ] || false'
[Install]
我如何调试它,并让看门狗在启动时运行
我添加了以下内容/lib/systemd/system/watchdog.service
[Install]
WantedBy=multi-user.target
watchdog
现在开始。我需要测试以确保它有效!
答案1
这是 Debian 的一个已知错误。Debian 看门狗包的 systemd 集成经历了几轮,变化很大。正如您所发现的,作为 Debian 8 发布的看门狗包实际上是不起作用的。预发布测试没有发现这一点。
该错误已在该包的 5.15-1 版本中得到修复,同时还修复了错误的服务单元语法(也可以在您的服务单元中看到)。该版本在 Debian 8 向后移植中不可用,尽管已经提出了两个请求(显然被忽略)。
进一步阅读
- 保罗·门泽尔 (2016-09-19)。systemd 服务文件中的语法错误。错误#838305。 Debian 错误跟踪器。
- 乌韦·斯托贝克 (2014-11-05)。看门狗不在启动时启动。错误#768168。 Debian 错误跟踪器。
- 安德烈亚斯·斯坦内尔 (2015-07-22)。新安装的 Jessie 无法自动启动。错误#793309。 Debian 错误跟踪器。
- 迈克尔·梅克斯 (2016-02-26)。 接受看门狗 5.15-1(来源 amd64)进入不稳定状态。 debian-devel-changes。
答案2
对于armbian,您可以手动安装更新包:
wget http://ftp.debian.org/debian/pool/main/w/watchdog/watchdog_5.15-2_armhf.deb
dpkg -i watchdog_5.15-2_armhf.deb
systemctl enable watchdog