]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: Set RebootWatchdogSec to 60s as watchdog rbt/watdog
authorRobert Yang <liezhi.yang@windriver.com>
Fri, 27 May 2022 06:23:14 +0000 (23:23 -0700)
committerRobert Yang <liezhi.yang@windriver.com>
Fri, 27 May 2022 07:05:42 +0000 (00:05 -0700)
The systemd-shutdown sets watchdog timeout to 10m (600 seconds) which is too
large, and caused errors when reboot on boars such as rpi4:

systemd-shutdown[1]: Failed to set timeout to 10min: Invalid argument

The watchog's default value is 60s, so set RebootWatchdogSec to 60s to fix the
errors. And <machin.conf> can set WATCHDOG_TIMEOUT when needed, for example,
the max timeout of rpi4 is 15 seconds.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
meta/recipes-core/systemd/systemd_250.5.bb
meta/recipes-extended/watchdog/watchdog-config.bb

index 006b2f86eab251f496ce7b62f42e404b1d335eb9..6fac27ee56dbab93f136612a1a1d02d64609810e 100644 (file)
@@ -238,6 +238,9 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
                   -Dnologin-path=${base_sbindir}/nologin \
                   -Dumount-path=${base_bindir}/umount"
 
+# The 60 seconds is watchdog's default vaule.
+WATCHDOG_TIMEOUT ??= "60"
+
 do_install() {
        meson_do_install
        install -d ${D}/${base_sbindir}
@@ -337,6 +340,11 @@ do_install() {
 
        # add a profile fragment to disable systemd pager with busybox less
        install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
+
+    if [ -n "${WATCHDOG_TIMEOUT}" ]; then
+        sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
+            ${D}/${sysconfdir}/systemd/system.conf
+    fi
 }
 
 python populate_packages:prepend (){
index a28d28033bcfa080bd9151323618085762906daf..f13895212842c84fbe0f2bb164dcc8ecd4de8f25 100644 (file)
@@ -13,8 +13,15 @@ SRC_URI = " \
     file://watchdog.conf \
 "
 
+# The default value is 60 seconds when null.
+WATCHDOG_TIMEOUT ??= ""
+
 do_install() {
     install -Dm 0644 ${WORKDIR}/watchdog.default ${D}${sysconfdir}/default/watchdog
     install -Dm 0644 ${WORKDIR}/watchdog.conf ${D}${sysconfdir}/watchdog.conf
+
+    if [ -n "${WATCHDOG_TIMEOUT}" ]; then
+        echo "watchdog-timeout = ${WATCHDOG_TIMEOUT}" >> ${D}/etc/watchdog.conf
+    fi
 }