Systemd
systemd 啟動看門狗的問題
我正在嘗試啟用該
watchdog
服務(在 Raspbian Jessie 上)。我已經安裝
watchdog
並(希望)配置了它。sudo systemctl start watchdog
似乎可以開始了
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, ...).
嘗試
sudo update-rc.d watchdog enable
似乎沒有成功 systemctl list-units | 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
現在開始。我需要測試以確保它有效!
這是一個已知的 Debian 錯誤。Debian 看門狗軟體包的 systemd 集成經歷了幾輪,變化很大。正如您所發現的,作為 Debian 8 發布的 watchdog 軟體包實際上是不起作用的。預發布測試沒有發現這一點。
該錯誤已針對該軟體包的 5.15-1 版本進行了修復,此外還有另一個修復錯誤的服務單元語法(在您的服務單元中也可見)。這個版本在 Debian 8 backports 中不可用,儘管已經提出了兩個請求(並且顯然被忽略了)。
進一步閱讀
- 保羅·門澤爾 (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-更改。