diff mbox series

systemd: Add WATCHDOG_RUNTIME_SEC optional variable

Message ID 20241219111615.601-1-egyszeregy@freemail.hu
State Accepted, archived
Commit 1c61a1eb9c4faa9ab32b0440bbdd88c22c3cd945
Headers show
Series systemd: Add WATCHDOG_RUNTIME_SEC optional variable | expand

Commit Message

Livius Dec. 19, 2024, 11:16 a.m. UTC
s=20181004; d=freemail.hu;

	h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;

	l=1751; bh=SOtVjpovb8GEQjj/6PhL652jcamo2arPKAPsCBAMAC4=;

	b=zmfZNqw1S+s5YL85QDtiX5EGp84S7r1i8qrxR6Ehp3UIZzqiicCTn4k6qBs8A/fh

	0AUTtZZWyFcBvE9P9NU636rQpR/PQ36AlqughUhps3uc4VtBlrSLS2OohIBGCptREdc

	it9VhTWZgOc3xbKZDb0LEmdwRSzP4wVn9IVvY1GDX1YA0MUvXFeLnVSzybvqLygbTMB

	RhHRAVakbL8+xakvUC+5+bbaZ0Ewn/qx9YIpZ2wUqhxnHDB1Z5pD1UqR77jSybUPNLs

	l9srkJar4ywaEJiMDTzIRAHCXV16F+kyrvQowG+lEWNDt1xhCRY5XY/Dcj/jHt4sDUO

	jyWyaMXngw==
Content-Transfer-Encoding: quoted-printable

From: Benjamin Sz=C5=91ke <egyszeregy@freemail.hu>

To make use of the hardware watchdog it is sufficient to set
the RuntimeWatchdogSec=3D option in /etc/systemd/system.conf.
It defaults to 0 (i.e. no hardware watchdog use). Set it to
a value like 20s and the watchdog is enabled.

ref: https://0pointer.de/blog/projects/watchdog.html
Signed-off-by: Benjamin Sz=C5=91ke <egyszeregy@freemail.hu>
---
 meta/recipes-core/systemd/systemd_256.9.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)

 do_install() {
 	meson_do_install
=20
@@ -383,6 +388,11 @@ do_install() {
 			${D}/${sysconfdir}/systemd/system.conf
 	fi
=20
+	if [ -n "${WATCHDOG_RUNTIME_SEC}" ]; then
+		sed -i -e 's/#RuntimeWatchdogSec=3Doff/RuntimeWatchdogSec=3D${WATCHDOG=
_RUNTIME_SEC}/' \
+			${D}/${sysconfdir}/systemd/system.conf
+	fi
+
 	if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', =
d)}; then
 		if ! grep -q '^NamePolicy=3D.*mac' ${D}${nonarch_libdir}/systemd/netwo=
rk/99-default.link; then
 			sed -i '/^NamePolicy=3D/s/$/ mac/' ${D}${nonarch_libdir}/systemd/netw=
ork/99-default.link
--=20
2.47.1.windows.1

Comments

patchtest@automation.yoctoproject.org Dec. 19, 2024, 11:31 a.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/systemd-Add-WATCHDOG_RUNTIME_SEC-optional-variable.patch

FAIL: test mbox format: Series has malformed diff lines. Create the series again using git-format-patch and ensure it applies using git am (test_mbox.TestMbox.test_mbox_format)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: Python-unidiff parse error (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: Parse error Unexpected hunk found: @@ -383,6 +388,11 @@ do_install() {
SKIP: test Signed-off-by presence: Parse error Unexpected hunk found: @@ -383,6 +388,11 @@ do_install() {
SKIP: test Upstream-Status presence: Parse error Unexpected hunk found: @@ -383,6 +388,11 @@ do_install() {
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: Python-unidiff parse error (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
Livius Dec. 29, 2024, 2:36 p.m. UTC | #2
It seems Patchtest is still buggy
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15517
Ross Burton Jan. 8, 2025, 3:14 p.m. UTC | #3
On 19 Dec 2024, at 11:16, Livius via lists.openembedded.org <egyszeregy=freemail.hu@lists.openembedded.org> wrote:
> +# To make use of the hardware watchdog it is sufficient to set WATCHDOG_RUNTIME_SEC
> +# (RuntimeWatchdogSec= option in /etc/systemd/system.conf) to a value like 20s
> +# and the watchdog is enabled. (defaults is no hardware watchdog use)
> +WATCHDOG_RUNTIME_SEC ??= ""
> +

> + if [ -n "${WATCHDOG_RUNTIME_SEC}" ]; then
> + sed -i -e 's/#RuntimeWatchdogSec=off/RuntimeWatchdogSec=${WATCHDOG_RUNTIME_SEC}/' \
> + ${D}/${sysconfdir}/systemd/system.conf
> + fi

We’re slowly adding more variables for system.conf, which is explictly designed to be extended with configuration snippets.  The logical conclusion of this is that every option in system.conf has a variable in the recipe to set it.

A more scalable approach would be to just use configuration snippets, ie you write your watchdog assignments to /etc/systemd/system.conf.d/watchdog.conf. This doesn’t involve touching the systemd recipe and will override the defaults.

What do you think about this approach?

Ross
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd_256.9.bb b/meta/recipes-co=
re/systemd/systemd_256.9.bb
index a9224915c6..84888b88f1 100644
--- a/meta/recipes-core/systemd/systemd_256.9.bb
+++ b/meta/recipes-core/systemd/systemd_256.9.bb
@@ -266,6 +266,11 @@  EXTRA_OEMESON +=3D "-Dkexec-path=3D${sbindir}/kexec =
\
 # The 60 seconds is watchdog's default vaule.
 WATCHDOG_TIMEOUT ??=3D "60"
=20
+# To make use of the hardware watchdog it is sufficient to set WATCHDOG_=
RUNTIME_SEC
+# (RuntimeWatchdogSec=3D option in /etc/systemd/system.conf) to a value =
like 20s
+# and the watchdog is enabled. (defaults is no hardware watchdog use)
+WATCHDOG_RUNTIME_SEC ??=3D ""
+