Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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

Summary: ShutdownWatchdogSec value is not taken into account on reboot
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: systemdAssignee: David Tardon <dtardon>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.6CC: dtardon, jamacku, qguo, sbroz, systemd-maint-list
Target Milestone: rcKeywords: Bugfix, EasyFix, Patch, Reproducer, Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-239-70.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2127170 2127171 2127172 (view as bug list) Environment:
Last Closed: 2023-05-16 09:07:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2127170, 2127171, 2127172    
Attachments:
Description Flags
Backport none

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