[Nut-upsuser] Ups not shutting down

Arjen de Korte nut+users at de-korte.org
Wed Jun 13 09:58:58 UTC 2007

>> If all else fails, your could use a method that is described in the FAQ.
>> After sending the 'upsdrvctl shutdown' command in the halt script, wait
>> for about 10 minutes and then reboot. If the UPS is really on battery,
>> this is probably sufficient to drain the batteries completely and make
>> it shutdown by itself. If the mains has returned in the mean time, it
>> will just reboot. This is a huge kludge though.
> I can't seem to find the method described in the FAQ !
> I presume you were talking about this faq >
> http://www.networkupstools.org/faq/

Yes. What may have confused you here, that I meant that the method is
described in the FAQ, however the source of the problem is not the same. I
could have described this more clearly. Never mind that, here follows the
FAQ entry that I meant. I always use this method (no matter what) to deal
with race conditions when the UPS needs different commands to shutdown,
depending on the actual power status (mine do):

 Q: Everything works perfectly during the shutdown, and the UPS comes
    back on, but my system stays off.  What's happening?

 A: Assuming you don't have the problem in the next question, then you
    probably have an ATX motherboard, have APM or ACPI enabled in your
    kernel (assuming Linux here), and are reaching the 'halt' at the
    bottom of your shutdown scripts.

    Your machine obeys and shuts down, and stays down, since it
    remembers the 'last state' when the UPS restarts.

    One solution is to change your shutdown scripts so you never reach
    that point.  You *want* the system to die without reaching the
    part where the kernel tells it to shut down.  A possible script
    might look like this:

	# other shutdown stuff here (mount -o remount,ro ...)

	if (test -f /etc/killpower)
		/usr/local/ups/bin/upsdrvctl shutdown

		sleep 600	# this should never return

		# uh oh, we never got shut down! (power race?)

	halt -p

    The other solution is to change your BIOS setting to "always power
    on" instead of "last state", assuming that's possible.

In the file 'docs/shutdown.txt' we describe something similar (although
the 'reboot' command is missing there) with a much shorter interval
though. You should probably wait a little longer than the 120 seconds from
that file, to make sure the UPS really reaches the state where the
batteries are empty and it switches off. You should really read the parts
on "How you set it up", "Power races" and "Testing power races".

Note that this is not a real solution to your problem, although it may
prevent your server to deadlock forever. As said, this is a huge kludge
and you really should try to figure out how to make your UPS cycle the
power if the power returns after between the moment the UPS signals a low
battery and where 'upsdrvctl shutdown' is run. Waiting for the batteries
to drain is not recommended.

Best regards, Arjen

More information about the Nut-upsuser mailing list