Bug 1993983

Summary: wdctl not picking up reboot reason flag
Product: [Fedora] Fedora Reporter: Jose <jnoguera>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: POST --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: hdegoede, jonathan, kzak, pbrobinson, perobins
Target Milestone: ---Keywords: Tracking
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2057046 (view as bug list) Environment:
Last Closed: 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: 2057046    
Attachments:
Description Flags
Proposed patch none

Description Jose 2021-08-16 13:39:22 UTC
Created attachment 1814440 [details]
Proposed patch

Description of problem: `wdctl` does not show reboot reason flags when current boot was watchdog triggered.


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


How reproducible: Always.


Steps to Reproduce:
1. Install the watchdog daemon: yum install watchdog
2. Uncomment this line in /etc/watchdog.conf: watchdog-device = /dev/watchdog
3. Start the daemon: systemctl start watchdog.service
4. As root, do `echo c > /proc/sysrq-trigger`. This will cause a kernel panic.
5. Wait for the watchdog to reboot the system.
6. Once booted, run `sudo wdctl`.

Actual results:

Example from a VM:
```
[jose@fedora ~]$ sudo wdctl 
Device: /dev/watchdog0
Identity: i6300ESB timer [version 0]
Timeout: 30 seconds
Pre-timeout: 0 seconds
FLAG DESCRIPTION STATUS BOOT-STATUS
KEEPALIVEPING Keep alive ping reply 1 0
MAGICCLOSE Supports magic close char 0 0
SETTIMEOUT Set timeout (in seconds) 0 0
```

Expected results:
```
$ sudo wdctl
Device: /dev/watchdog0
Identity: i6300ESB timer [version 0]
Timeout: 30 seconds
Pre-timeout: 0 seconds
FLAG DESCRIPTION STATUS BOOT-STATUS
CARDRESET Card previously reset the CPU 1 1
KEEPALIVEPING Keep alive ping reply 1 0
MAGICCLOSE Supports magic close char 0 0
SETTIMEOUT Set timeout (in seconds) 0 0
```

Additional info:

Hans De Goede made a patch for this (attached). This patch is what I used in order to get the result provided in `Expected results`.

Comment 1 Karel Zak 2021-08-18 09:50:05 UTC
Applied to the upstream tree http://github.com/karelzak/util-linux/commit/b1b0259fe42aad1bf0997ce1c03a020ce59e38ab