Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
clepple opened this issue Feb 13, 2017 · 5 comments
Open

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

clepple opened this issue Feb 13, 2017 · 5 comments

Comments

@clepple
Copy link
Member

clepple commented Feb 13, 2017

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.

@jimklimov
Copy link
Member

jimklimov commented Feb 15, 2017

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

We can have:

  • upsd listening just on localhost for the local upsmon to drive graceful shutdowns; for a local-media UPS or even a battery (if we get to wrap those with NUT drivers), this can work to protect systems without any real network - probably needs the system to start up loopback networking though;
  • upsd normally listening on "any" (*) interface - whatever is currently "up" so kernel delivers the packets to the daemon;
  • upsd listening on particular interface or address - and those may be dynamic (dhcp, usb-plug, etc.)

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
Copy link

@jimklimov , you typically have 2 network targets:

  • network.target
  • network-online.target

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
Copy link
Member Author

clepple commented Feb 15, 2017

@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
Copy link

mrjackson commented Jun 21, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants