RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2127131 - ShutdownWatchdogSec value is not taken into account on reboot
Summary: ShutdownWatchdogSec value is not taken into account on reboot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.6
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 2127170 2127171 2127172
TreeView+ depends on / blocked
 
Reported: 2022-09-15 12:26 UTC by Renaud Métrich
Modified: 2023-05-16 11:11 UTC (History)
5 users (show)

Fixed In Version: systemd-239-70.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2127170 2127171 2127172 (view as bug list)
Environment:
Last Closed: 2023-05-16 09:07:33 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Backport (1021 bytes, patch)
2022-09-15 13:14 UTC, Renaud Métrich
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Github redhat-plumbers systemd-rhel8 pull 326 0 None open core: move reset_arguments() to the end of main's finish 2022-09-19 13:56:41 UTC
Github systemd systemd pull 17088 0 None Merged core: move reset_arguments() to the end of main's finish 2022-09-19 07:42:57 UTC
Red Hat Issue Tracker RHELPLAN-134063 0 None None None 2022-09-15 12:37:36 UTC
Red Hat Knowledge Base (Solution) 6976192 0 None None None 2022-09-19 07:26:14 UTC
Red Hat Product Errata RHBA-2023:2985 0 None None None 2023-05-16 09:08:18 UTC

Description Renaud Métrich 2022-09-15 12:26:48 UTC
Description of problem:

When setting ShutdownWatchdogSec=2min for example and using the softdog watchdog (or any other implementation), we can see through a systemtap kernel module that the setting is not taken into account but 600 is used instead (== 10 minutes, the default):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# cat /etc/systemd/system.conf
...
RuntimeWatchdogSec=5min
ShutdownWatchdogSec=2min
...

# mkdir -p /var/log/journal
# systemctl restart systemd-journald

# stap -g -m watch_systemd -p 4 -d /usr/lib/systemd/systemd --ldd -e 'probe process("/usr/lib/systemd/libsystemd-shared-239.so").function("watchdog_set_timeout") { printk(2, sprintf("%ld (%s) calling watchdog_set_timeout(%ld)", pid(), execname(), user_long($usec)))
# staprun -L ./watch_systemd.ko
# reboot
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Result:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# journalctl -b -1 SYSLOG_IDENTIFIER=kernel -o short-precise --no-pager | grep watchdog_set_timeout
Sep 15 13:52:21.248313 vm-rhel8 kernel: 1 (systemd) calling watchdog_set_timeout(600000000)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The root cause for this is missing Upstream commit 7d9eea2bd3d4f83668c7a78754d201b226acbf1e.
Without this commit, *arg_shutdown_watchdog* variable is reset to the default before calling the shutdown code, as shown below, excerpt of systemd-239/src/core/main.c:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 :
2617 finish:
2618         pager_close();
2619 
2620         if (m) {
2621                 arg_shutdown_watchdog = m->shutdown_watchdog;  <<<< VALUE RETRIEVED FROM RUNTIME SETTING
2622                 m = manager_free(m);
2623         }
2624 
2625         reset_arguments(); <<<< VALUE RESET TO DEFAULT (10 MINS)
 :
2654         if (shutdown_verb) {
2655                 r = become_shutdown(shutdown_verb, retval); <<<< SHUTDOWN CODE CALLED
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

systemd-239

How reproducible:

Always, see above.

Comment 1 Renaud Métrich 2022-09-15 13:14:12 UTC
Created attachment 1912047 [details]
Backport

Comment 2 Renaud Métrich 2022-09-15 13:16:42 UTC
I can confirm that the above patch fixes the issue.

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# stap -g -m watch_systemd -p 4 -d /usr/lib/systemd/systemd --ldd -e 'probe process("/usr/lib/systemd/libsystemd-shared-239.so").function("watchdog_set_timeout") { printk(2, sprintf("%ld (%s) calling watchdog_set_timeout(%ld)", pid(), execname(), user_long($usec)))
# staprun -L ./watch_systemd.ko
# reboot
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Journal:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Sep 15 15:09:38.816936 vm-rhel8 kernel: 1 (systemd) calling watchdog_set_timeout(120000000)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 7 Plumber Bot 2022-12-08 12:06:40 UTC
fix merged to github main branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/326

Comment 14 errata-xmlrpc 2023-05-16 09:07:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2985


Note You need to log in before you can comment on or make changes to this bug.