[PATCH 0/1] systemd: Set RebootWatchdogSec to 60s as watchdog

STALE1601d

4 messages, 2 authors, 2022-05-28 · open the first message on its own page

[PATCH 0/1] systemd: Set RebootWatchdogSec to 60s as watchdog

From: Robert Yang <hidden>
Date: 2022-05-27 07:07:17

The following changes since commit 579906b9f4ea32c8d4e0e11a87ee6c9e27cdf0dc:

  kernel.bbclass: Do not overwrite recipe's custom postinst (2022-05-23 21:31:07 +0100)

are available in the Git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/watdog
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/watdog

Robert Yang (1):
  systemd: Set RebootWatchdogSec to 60s as watchdog

 meta/recipes-core/systemd/systemd_250.5.bb        | 8 ++++++++
 meta/recipes-extended/watchdog/watchdog-config.bb | 7 +++++++
 2 files changed, 15 insertions(+)

-- 
2.35.1

[PATCH 1/1] systemd: Set RebootWatchdogSec to 60s as watchdog

From: Robert Yang <hidden>
Date: 2022-05-27 07:07:17

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 <redacted>
---
 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

Re: [OE-core] [PATCH 1/1] systemd: Set RebootWatchdogSec to 60s as watchdog

From: Alexander Kanavin <hidden>
Date: 2022-05-27 19:13:01

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.

Alex

On Fri, 27 May 2022 at 09:07, Robert Yang [off-list ref] wrote:
quoted hunk
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 <redacted>
---
 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 (#166202): https://lists.openembedded.org/g/openembedded-core/message/166202
Mute This Topic: https://lists.openembedded.org/mt/91371988/1686489
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [OE-core] [PATCH 1/1] systemd: Set RebootWatchdogSec to 60s as watchdog

From: Robert Yang <hidden>
Date: 2022-05-28 08:49:55

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 [off-list ref] wrote:
quoted
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 <redacted>
---
  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 (#166202): https://lists.openembedded.org/g/openembedded-core/message/166202
Mute This Topic: https://lists.openembedded.org/mt/91371988/1686489
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
-=-=-=-=-=-=-=-=-=-=-=-

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help