[Nut-upsuser] Various NUT issues/questions

Peter Selinger selinger at mathstat.dal.ca
Sat May 13 02:24:23 UTC 2006


Scott "Tuc" Ellentuch at T-B-O-H wrote:
> 
> > You did not configure your shutdown scripts correctly; see item 11
> > under "Configuring shutdowns for low battery events" in INSTALL.  Your
> > computer is supposed to power off (after going through the usual
> > shutdown procedure) by letting the UPS know to shut down its
> > load. This will cause the UPS to cut power to the computer, and then
> > sit there until power comes back on. In the event that the power
> > returns while the shutdown is already in progress, the UPS will cut
> > power to the computer for a few seconds, then come back on. This
> > ensures that your computer will never be in a bad state. 
> > 
> 	Ok, I did that. For what I can see/tell for FreeBSD,
> they suggest to put it into the /etc/rc.shutdown script. So I
> did that. I pulled the plug. It went onto battery, got to
> 30% (Which I still think is incredibly high, still looking to
> see how to reduce it). The machine did its shutdown, and then
> killed the power and the UPS turned off. I plugged it back in
> and the UPS/System came back. Well, the system SORT OF came back.
> The filesystems were so corrupted that it wouldn't come up.
> :-/ This won't do. I'm normally a 9 hour drive from here, and we
> lose power even on clear sunny days... :-/ 
> 
> 	Is there anything I can do to let the machine shut down
> all the way THEN the UPS? 

Yes, of course, that's what you were *supposed* to do :)
You have to put the command that yanks the power from the computer at
the very *end* of your shutdown script, i.e., after all the file
systems have been unmounted (or remounted read-only, in the case of
the root file system, which hopefully contains the newhidups driver
and upsdrvctl).

In other words, you want to yank the power just before /sbin/halt or
/sbin/reboot or whatever would be called (this is from Linux; might
look different but similar in *BSD). 

To quote from INSTALL:

    You should configure your system to power down the UPS after the
                                                           ^^^^^^^^^
    filesystems are remounted read-only.  Have it look for the
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    presence of the POWERDOWNFLAG (from upsmon.conf), using this as an
    example:

        if (test -f /etc/killpower)
        then
                echo "Killing the power, bye!"
                /usr/local/ups/bin/upsdrvctl shutdown

                sleep 120

                # uh oh... the UPS power-off failed
                # you probably want to reboot here so you don't get
                # stuck!
                # *** see the section on power races in shutdown.txt!
                # ***
        fi

    Be careful: that upsdrvctl command will probably power off your
    machine.  Don't use it unless your system is ready to be halted by
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    force.  If you run RAID, be sure the arrays are ready to lose
    ^^^^^^
    power.  Your kernel's power-off routines may not execute.

    Make sure that the filesystem(s) holding your UPS drivers and
    configuration details are still mounted when that part of the
    script is run.  You need upsdrvctl, ups.conf, and any drivers for
    the hardware on your system.


> I tried changing ups.delay.shutdown
> to 2 minutes and found that its 2 minutes from when you set it,
> and it seemed to be a "HARD" down.. I had to press the button
> to get it to start up again.
> 
> 	I hate to be a pain, but I'm not sure if its the UPS
> I was guided to choose, my lack of knowledge of NUT, or my
> desire to have what isn't available.

It's point 2, mostly, I am afraid :) -- Peter





More information about the Nut-upsuser mailing list