Hi Alexander,

On 5/28/22 03:12, Alexander Kanavin wrote:
Where is the default of 10 minutes set? Should it be fixed there?
Patching things with sed after the fact is not necessarily a good
idea.

It's set in src/core/main.c, line 2451:

arg_reboot_watchdog = 10 * USEC_PER_MINUTE;

The ${sysconfdir}/systemd/system.conf is used for configing it, so I didn't
modify src/core/main.c, and even if we modify src/core/main.c, we still need
config the value depend on the boards, for example, rpi4 (max: 15 seconds),
nxp-imx8 (max: 128 seconds), other boards may have a higher or lower value
than 60.

// Robert


Alex

On Fri, 27 May 2022 at 09:07, Robert Yang <liezhi.y...@windriver.com> wrote:

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.y...@windriver.com>
---
  meta/recipes-core/systemd/systemd_250.5.bb        | 8 ++++++++
  meta/recipes-extended/watchdog/watchdog-config.bb | 7 +++++++
  2 files changed, 15 insertions(+)

diff --git a/meta/recipes-core/systemd/systemd_250.5.bb 
b/meta/recipes-core/systemd/systemd_250.5.bb
index 006b2f86eab..6fac27ee56d 100644
--- a/meta/recipes-core/systemd/systemd_250.5.bb
+++ b/meta/recipes-core/systemd/systemd_250.5.bb
@@ -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 (){
diff --git a/meta/recipes-extended/watchdog/watchdog-config.bb 
b/meta/recipes-extended/watchdog/watchdog-config.bb
index a28d28033bc..f1389521284 100644
--- a/meta/recipes-extended/watchdog/watchdog-config.bb
+++ b/meta/recipes-extended/watchdog/watchdog-config.bb
@@ -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
  }

--
2.35.1




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#166222): 
https://lists.openembedded.org/g/openembedded-core/message/166222
Mute This Topic: https://lists.openembedded.org/mt/91371988/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to