[Nut-upsdev] Important regression in usbhid-ups (r1113)

Peter Selinger selinger at mathstat.dal.ca
Sun Feb 24 00:14:10 UTC 2008

Hi Arjen,

Arjen de Korte wrote:
> Peter Selinger wrote:
> > What you describe would take the form something like the following:
> > 
> >         if (test -f /etc/killpower)
> >         then
> >                 echo "Scheduling power supply to shut off in 20 seconds"
> >                 /usr/local/ups/bin/upsdrvctl shutdown
> > 	fi
> > 	
> > 	echo "Killing the power, bye!"
> > 	/sbin/halt
> > 
> > But this method has its own drawbacks: if the UPS in fact fails to power
> > off, then the system will not reboot without human (and physical!)
> > intervention. This kind of thing has happened to me often - during
> > testing, and more importantly, after upgrading.  Perhaps a missing USB
> > bus, /usr/local not mounted, a driver has been renamed in a new NUT
> > version and upsdrvctl refuses to recognize its configuration file, or any
> > such similar problem. It's amazing how often I have actually used the
> > "you probably want to reboot here" scenario.
> You're absolutely right. I'm not proposing to remove that statement from
> the INSTALL file, because if there is a risk that the UPS fails to power
> off (many, if not all, contact closure types UPS when on mains), this
> might be the only way to prevent the system waiting for a power-cycle
> that never comes. In that case, waiting 20 seconds before powering off
> is pointless indeed.
> Either you risk some hardware degradation or hanging around at the end
> of your halt script. Choose your poison. The point from the discussion
> (I think it was somewhere in a Debian mailinglist) was that this should
> be an explicit choice of the user and that we should not package NUT to
> use either of these.

I am not saying that you are wrong; only that this particular behavior
should be reconsidered. You are right that when you changed the
default to 20 seconds, you only followed what was written on the
usbhid-ups man page all along. However, browsing the man pages, I
found that the default offdelay value is:

0 in the megatec driver
undefined in the megatec_usb driver
20 seconds in the mge-shut driver
120 seconds in the mge-utalk driver
64 seconds in the tripplite driver
undefined in the tripplite_usb driver
20 seconds in the usbhid-ups driver
and undefined in all other drivers, according to their man pages.

This violates the common-sense rule that the default behavior should
not be something arbitrary and unpredictable. In my opinion, the only
reasonable default value that is not arbitrary is 0. 

As the discussions on some Debian mailing list: I believe each
packager (including Debian) is free to set their own defaults, which
are designed to work best with that packager's shutdown scripts
etc. However, the defaults in the source distribution should work well
with a standard from-source installation as described in the file
INSTALL, and should be as intuitive as possible. 

Intuitively, when I type "upsdrvctl shutdown", I expect the power to
shut down. If nothing happens, I will think there is a problem and
start doing something else. Then, in the middle of something else, the
power will suddenly go off, and I will not be sure why. Moreover,
neither the description of "shutdown" in the upsdrvctl(8) man page,
nor the description of "-k" in the nutupsdrv(8) man page mentions a
delay, much less an arbitrary driver-specific default delay.

As you point out, there will be some users that need to shut down
their harddrives by some other method before cutting their power
supply. But such users will either be following alternate instructions
(which should then also direct them to set the offdelay value - this
is even necessary currently because the default is a driver specific
value). Or else such users will know what they are doing and why.

For all of these reasons, I propose to make the new default offdelay
"0" system-wide through all drivers. 

-- Peter

More information about the Nut-upsdev mailing list