Checking for network online

Patrick Williams patrick at stwcx.xyz
Thu Feb 24 00:58:45 AEDT 2022


On Fri, Feb 18, 2022 at 11:39:03AM -0800, Johnathan Mantey wrote:
> On 2/18/22 11:04, Doman, Jonathan wrote:
> > On Thu, 2022-02-17 at 14:54 -0800, Johnathan Mantey wrote:

> > 
> > Did you try removing the Wants/After=network-online.target from
> > rsyslog.service to see if the situation improves? If it does, then we
> > can discuss removing that dependency or making it configurable.
> 
> No, I had not tried that. My take on doing so is that it'll be like 
> playing whack a mole. Some other service may decide to rely on 
> systemd-networkd-wait-online. The issue is now compounded as a result.

I don't understand why this is a particularly difficult problem.  You asked me
on Discord how I figured this out and I said "grep".  You literally just look
for a service that depends on `network-online.target`.

No service should depend on systemd-networkd-wait-online directly.  If they do,
this is a bug.  They are always depending on network-online.target.

Services depend on network-online.target for valid reasons.  As far as I can
tell, currently, only rsyslog* has this dependency (at least on Witherspoon and
Bletchley).  If a new service adds this dependency, and you have an issue with
it, I think you should take some time to reason about why this dependency was
added rather than simply ignoring it (by a force-disable on
systemd-networkd-wait-online).

"Fixing" the rsyslog dependency in your system is a pretty trivial
`do_install:append` with a `sed` in it to strip out the line.  Catching new
dependencies is a fairly simple `ROOTFS_POSTPROCESS_COMMAND` to check all the
service files in `/lib/systemd/system` for a `network-online.target` dependency.

* As I mentioned in Discord, rsyslog having this dependency by default makes
  good sense from the upstream's perspective.  rsyslog is _typically_
  configured for remote offload of the syslog (hence, r in rsyslog).  It just
  happens that we have this unusual Rube Goldberg transformation using rsyslog
  for formulating the SEL and Redfish log files.  For that transformation the
  dependency isn't necessary, but for people who use rsyslog as it is intended
  they probably want the dependency (as I've mentioned in another email we do).

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20220223/310f4cce/attachment-0001.sig>


More information about the openbmc mailing list