[Nut-upsuser] Startup timing issue with CyberPower CP425HG UPS

Arun twelvefortyfive at yahoo.com
Fri Apr 1 18:33:49 UTC 2011


--- On Thu, 3/31/11, Charles Lepple <clepple at gmail.com> wrote:

> From: Charles Lepple <clepple at gmail.com>
> Subject: Re: [Nut-upsuser] Startup timing issue with CyberPower CP425HG UPS
> To: "Arun" <twelvefortyfive at yahoo.com>
> Cc: nut-upsuser at lists.alioth.debian.org
> Date: Thursday, March 31, 2011, 7:25 PM
> On Mar 30, 2011, at 9:46 PM, Arun
> wrote:
> 
> > I'm not sure how to fix this, other than to perhaps
> start the "ups" service from the udev rules file if a known
> USB UPS device has been found, but that seems like a rather
> ugly way to go about this. Does anyone have any thoughts?
> 
> I have had a sneaking suspicion that in some situations,
> starting a USB driver from hotplug or udev might work
> better, and this is definitely one of those cases.

Yeap. IMO an even better option (if technically feasible) would be for the driver to try and reconnect to the UPS every few seconds. It seems to do this well if it loses connectivity after having established the initial connection, but not at all at startup.

> 
> Before you get too far into this, you probably want to make
> sure that when power returns, your UPS will wait until the
> battery is charged to some threshold before powering on its
> outlets. Otherwise, if the power goes off-on-off (with a
> shutdown after the first power failure), the UPS might try
> to start the computer up with a discharged battery, and due
> to the delay in connecting to the UPS, NUT would not get the
> low battery signal in time to shut down properly the second
> time.

Good point. Unfortunately this UPS is not very fancy, and immediately powers on its outlets when the power resumes.

> 
> The other trick is that the current NUT USB drivers will
> attempt to reattach to a device if it disappears. Especially
> during testing, it is helpful to be able to unplug and
> re-plug the UPS into the USB port. For this to work, the
> udev script could kill the driver which is waiting around
> for the UPS to come back. (That would only do the right
> thing on a single-UPS system.) Alternatively, you could
> check in the udev script to see if any of the USB drivers
> are running (look for the PID files, and run "kill -0" to
> see if the process is still around without actually
> terminating it).

I did a couple of tests and it looks like driver recovers well once the UPS is reconnected to the system. Unfortunately it doesn't seem to try to reconnect at all at startup.

> 
> On the other hand, you can also look into whether your
> startup scripts have configurable dependencies, and tell the
> NUT init.d script to start after the USB service has fully
> initialized. Not sure how that works in Fedora.

Me neither. I don't know if there is a "USB service" per se in Fedora; USB devices announce themselves individually as they are connected to the system. Most USB devices (the kbd, mouse, another UPS I tested) register with the system *before* the init.d script starts, it's just this one UPS that registers much later for some reason.

> 



More information about the Nut-upsuser mailing list