Bug 12565

Summary: watchdog.service dead on startup with systemd
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Scott Branden <scott.branden>
Component: coreAssignee: Maxin B. John <maxin.john>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: alex.kanavin, bkylerussell, meta.mr.watcher, meta.watcher, stephano
Version: 5.99   
Target Milestone: 2.5 M4   
Hardware: Other   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
fix none

Description Scott Branden 2018-02-22 00:03:02 UTC
The watchdog.service appears inactive on startup even though it is enabled.

It appears the [Install] directive is not correct for a yocto build.  If I change:
[Install]
WantedBy=default.target

to
WantedBy=multi-user.target

Then the watchdog service is properly activated.

When running "systemctl stop watchdog" there are some error messages printed related to wd_keepalive.  It seems some clean attempt is sitting here.
https://patchwork.openembedded.org/patch/144580/

But, I think that still doesn't solve the wd_keepalive issues.
Comment 1 Scott Branden 2018-02-22 15:57:01 UTC
Also, wd_keepalive is not handled properly.  After change above there are errors in the stop mechanism.

try running "systemctl stop watchdog" and you will see errors as the wd_keepalive script has not been installed by the watchdog recipe.
Comment 2 Maxin B. John 2018-03-13 06:49:25 UTC
Created attachment 4233 [details]
fix

Removed the inter-dependencies of watchdog and wd_keepalive services.
Comment 3 Maxin B. John 2018-03-13 06:57:10 UTC
@Scott, can you please verify this fix and share your thoughts/comments ?
Comment 4 Scott Branden 2018-03-13 23:25:02 UTC
(In reply to comment #3)
> @Scott, can you please verify this fix and share your thoughts/comments ?

I will have to rollback my local changes and try it on my system in the next few days.
Comment 5 Scott Branden 2018-03-19 14:16:37 UTC
Hi Maxin,

I looked at the changes.

I don't think the claim that watchdog and watchdog-keepalive packages can't be installed together is what the original designers of these watchdog utilities intended.

I "think" what is supposed to happen is both services are supposed to be installed in the rootfs.  Then they are controlled by run_watchdog and wd_keepalive in the configuration file.

Possibly, as well, on shutdown, wd_keepalive is supposed to be started if watchdog is stopped?  That way watchdog is still kicked throughout shutdown.  In practical situations this probably isn't needed.

Also, why do you indicate the Upstream-status as: Inappropriate [oe specific].  I would think that the watchdog.service simply isn't being configured properly and such changes need to be upstreamed.  At least that's my impression?

If none of above is true and only one of run_watchdog or run_wd_keep_alive can be set then I guess what you've changed may be correct.  But, I would think upstream owner's should be able to comment further?
Comment 6 Maxin B. John 2018-03-20 06:10:25 UTC
Hi Scott,

(In reply to comment #5)
> Hi Maxin,
> 
> I looked at the changes.
> 
> I don't think the claim that watchdog and watchdog-keepalive packages can't
> be installed together is what the original designers of these watchdog
> utilities intended.

That claim was introduced by this commit:
"
commit e051c702503614b45d68f4c4c10ed413b2ea5c66
Author: Fabio Berton <fabio.berton@ossystems.com.br>
Date:   Wed Jan 25 09:22:05 2017 -0200

watchdog: Add RCONFLICTS to watchdog-keepalive and split RDEPENDS
"
IMHO, this splitting makes the watchdog handling less complex (avoids two daemons that handle watchdog at the same time, probably by wrong configuration)

> I "think" what is supposed to happen is both services are supposed to be
> installed in the rootfs.  Then they are controlled by run_watchdog and
> wd_keepalive in the configuration file.

It looks good. However, that could cause potential troubles with wrong configuration.

> Possibly, as well, on shutdown, wd_keepalive is supposed to be started if
> watchdog is stopped?  That way watchdog is still kicked throughout shutdown.
> In practical situations this probably isn't needed.

I am not sure about the practical use of that either.

> Also, why do you indicate the Upstream-status as: Inappropriate [oe
> specific].  I would think that the watchdog.service simply isn't being
> configured properly and such changes need to be upstreamed.  At least that's
> my impression?

Since we separated it into watchdog, wd_keepalive packages along with configuration package, changes that we introduced here are specific to oe.
 
> If none of above is true and only one of run_watchdog or run_wd_keep_alive
> can be set then I guess what you've changed may be correct.  

Ok.

> But, I would think upstream owner's should be able to comment further?

Agree. If the upstream maintainer feels it is wrong to go ahead with splitting the packages, we can revert those changes and go ahead with a better/safer fix.
Comment 7 Maxin B. John 2018-03-20 06:17:41 UTC
Adding Alex in CC
Comment 8 Alexander Kanavin 2018-03-20 11:36:39 UTC
I know even less about watchdog than you do :) Is there some specific question you'd like me to look into?
Comment 9 Maxin B. John 2018-04-13 04:55:23 UTC
Merged in oe-core:

https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=c3c336f106d579450ad09eedae830162a817214c

Sent a query to Fabio about the reason behind splitting the package. 

Scott, if you think that we need to revert those changes and fix it, please feel free to reopen this bug or open another bug.
Comment 10 Scott Branden 2018-04-13 10:07:19 UTC
current patch works my use cases.  But, I don't think it was the original intent for the option of specifying the wd_keepalive is started when the normal watchdog service is stop.  The wd_keepalive is a simpler implementation that can keep kicking the watchdog while everything is shutting down.

In practical situations (watchdog timeout long enough) this isn't an issue during linux shutdown/power off, though.
Comment 11 Maxin B. John 2018-04-13 13:26:22 UTC
Hi Scott,

(In reply to comment #10)
> current patch works my use cases.  But, I don't think it was the original
> intent for the option of specifying the wd_keepalive is started when the
> normal watchdog service is stop.  The wd_keepalive is a simpler
> implementation that can keep kicking the watchdog while everything is
> shutting down.
>
> In practical situations (watchdog timeout long enough) this isn't an issue
> during linux shutdown/power off, though.

Fabio mentioned that he agree with your views and also promised to work on a fix. Thanks !
Comment 12 Kyle Russell 2018-04-17 08:18:46 UTC
Is there an open issue tracking the work to resolve the RCONFLICT between watchdog and watchdog-keepalive?  The man page for wd_keepalive indicates it's intended to be used on system startup before the full watchdog service can start (the implication being both packages should be installed), and our system configuration uses it as such.