[Nut-upsuser] NUT 2.6.3, openSUSE 12.2 : UPS unit not switched off: Fixed

Arnaud Quette aquette.dev at gmail.com
Mon Oct 29 20:17:31 UTC 2012


Hi Roger,

note that I'm cc'ing Stanislav (maintainer of the NUT packages in Suse).
thanks for Kris Jordan for the support interim too ;)

2012/10/28 Roger Price <roger at rogerprice.org>

> On Fri, 26 Oct 2012, Kris Jordan wrote:
>
>> Did you install NUT from a package? Note, 2.6.5 is the current
>> version and 2.6.4 had fixed a vulnerability.
>>
>
> I'm using the nut 2.6.3 package included in the openSUSE 12.2 distribution.
>
>  Check that your distribution's shutdown script is running 'upsdrvctl
>> shutdown' in the presence of the killpower file
>> (POWERDOWNFLAG).
>>
>
> Summary: looks like an openSUSE bug, simple fix available.
>
> OpenSUSE 12.2 has a script /usr/sbin/rcupsd for starting and stopping the
> upsd service. This is a link to script /etc/init.d/upsd which contains:
>
>     powerdown)
>         ## Special command: Instruct UPS to shutdown.
>         sync &
>         if grep -q '^\[' $UPS_CONFIG ; then
>             echo -n "Instructing UPS to powerdown "
>             $UPSDRVCTL_BIN shutdown >/dev/null 2>&1 || rc_failed
>             rc_check
>         else
>             echo "No local UPS defined, skipping powerdown "
>         fi
>         rc_status -v
>         ;;
>     try-powerdown)
>         ## Special command: Instruct UPS to shutdown, if halt is running
>         ## or variable UPSD_POWERDOWN_CONDITION is set and power is
> failing.
>         ## Otherwise silently quit.
>         ##
>         if test "$RUNLEVEL" = "0" -o -n "$UPSD_POWERDOWN_CONDITION" ; then
>             if test -n "$POWERDOWNFLAG" -a -f "$POWERDOWNFLAG" ; then
>                 exec $0 powerdown
>             fi
>         fi
>         ;;
>
> where  UPSDRVCTL_BIN=/usr/lib/ups/**driver/upsdrvctl
>
> In addition, file /etc/sysconfig/shutdown contains the configuration
> parameter
>
>   # Hook during system shutdown to run extra command
>   HALT_POWERDOWN_INSERT="/etc/**init.d/upsd try-powerdown"
>
> but when upsd try-powerdown is called it fails silently because $RUNLEVEL
> and $UPSD_POWERDOWN_CONDITION are empty.  upsd powerdown is never called.
>
> I changed the configuration parameter to HALT_POWERDOWN_INSERT="/etc/**init.d/upsd
> powerdown", reran command SuSEconfig, and tried again but there was no
> change.  However typing the command /etc/init.d/upsd powerdown does shut
> down the UPS unit.
>
> OpenSUSE 12.2 has fully embraced systemctl and systemd: I tried grepping
> around in the /lib/systemd shutdown specifications, but I cannot find any
> reference to /etc/init.d/upsd powerdown.  This is beginning to look like a
> bug in openSUSE 12.2 which I will report in their forums.
>
> Here is a fix: There is a file /etc/init.d/halt.local which is currently
> empty:
>
>  # /etc/init.d/halt.local
>  # script with local commands to be executed from init on system shutdown
>  # Here you should add things, that should happen directly before shuting
>  # down.
>
> I added the lines
>
>  # RP 2012-10-28 Turn off the UPS unit.
>  # Needed for automatic system restart when wall power returns.
>  UPSDRVCTL_BIN=/usr/lib/ups/**driver/upsdrvctl
>  echo `date -I` `date +%T` "$0 calls $UPSDRVCTL_BIN shutdown" >>
> /var/log/halt.local
>  $UPSDRVCTL_BIN shutdown
>
> I pulled the plug from the wall and witnessed a server shutdown followed
> 10 seconds later by a UPS shutdown.  Pushing the plug back into the wall
> got the system running again.
>

I just saw that you (Roger) had a parallel discussion on Suse forums,
possibly leading toward some systemd integration issue...

maybe Stan can shed some light on this.

cheers,
Arnaud
-- 
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20121029/7bfc68ce/attachment.html>


More information about the Nut-upsuser mailing list