networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.08k stars 351 forks source link

upsd.conf: document race with LISTEN on specific interfaces #393

Open clepple opened 7 years ago

clepple commented 7 years ago

If a LISTEN option is encountered in upsd.conf before the interface is fully configured, upsd may fail to start. Tagged systemd because it seems that other init systems tend to wait until the interfaces are all configured before starting NUT.

See also #392.

clepple commented 7 years ago

Links from Manuel Wolfshant:

jimklimov commented 7 years ago

I wonder if there is a possibility for a single solution to rule them all?

We can have:

Is there some one systemd unit that wraps such networking use-cases for upsd service unit to "Require" or at least "Want" and start up "After"? On a similar note, in case of plug'n'play networking, including change of IP addresses and/or link-down/link-up events (but with the set of NICs remaining the same), do we want upsd to reconfigure or restart by venue of service dependencies?

But other than that, we can indeed pre-package the unit file with several commented-away variants of the setup and document the issue and when/how to tune it. As an implementation detail, we can follow suggestions posted by @peterhoeg in PR #330 - using the "drop-in configuration fragments without changing the unit file" which might be friendlier to packaging and more visible to local system administration.

The question of dependency on plug'n'play networking hardware may be related to udev on Linux, so also referencing PR #377 as something we may want to consider (in pre-set configs or at least note in documentation).

peterhoeg commented 7 years ago

@jimklimov , you typically have 2 network targets:

The former should be a safe bet, as all the network interfaces present at boot would be visible although they may not be configured yet.

How does upsd handle it if asked to listen on an unconfigured interface that subsequently is configured after upsd has started?

clepple commented 7 years ago

@peterhoeg the answer to your last question may be complicated by a logic bug (depending on whether the interface is the first in the configuration file), but the intent was to fail fast if the configuration did not match the interfaces at the time that upsd started.

mrjackson commented 4 years ago

In upsd.conf, use LISTEN 0.0.0.0 3493 instead of anything else and the issue "goes away".

The first link that @clepple posted explains why and what should be done in the last section.