[CentOS] [Fwd: Centos/RHEL with MGE UPS Protection Centers (usb)]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi all folks, 

Don't know if there's a copy of this notes in the CentOs mail-list, i
include it for further references due it has important notes,

Thanks Antoine Brenner for comments and suggestions,

Have good day

Jose.

--- Begin Message ---

Hello !

I would like to give some feedback concerning my recent installation of
MGE UPS of type Protection Center (usb link to the PC) on my Centos 4.3
and RHEL 4.3 systems. I had problems worth sharing installing nut with
a working shutdown process.


The following mail was a very good resource to start with, and I will
not repeat here what was already said:
http://lists.centos.org/pipermail/centos/2006-March/062495.html
Thanks to J.J.Garcia for posting it.

The problem with this howto is that the shutdown process will NOT
work as expected. (This is why I ccd you, J.J.Garcia). (See below)



Here are my comments:

I did not want to use the binary rpms from
http://opensource.mgeups.com/rhfc/
because we have our own yum repository. However, the sources from the
rpms above are not available from the mgeups.com server. (The sources for
the software is available, but not the .src.rpm).

Vanilla nut has a contrib directory with .spec files, but they do not
work on Centos/RHEL (they are valid for redhat linux up to version 9).
Fedora has some nut rpms, but they do not install the hotplug files needed
for the usb support:
/etc/hotplug/usb/libhidups
/etc/hotplug/usb/libhid.usermap

I ended up modifying the fedora rpms to add those hotplug files so
that newhidups works as expected. The source rpm can be found here:
http://www.gymglish.com/opensource/rpms/centos4-rpms/nut-2.0.2-2brx.src.rpm
but it would be nice to have those hotplug files directely in the nut fedora
rpm, since they are in the nut package.



This packaging issue alone would not have required a mail to the list, but
just following the instructions from J.J.Garcia will NOT give you a safe
shutdown !


There are multiple problems to solve before the shutdown works as expected.
(For those of you who do not know what the issue is, I recommend reading
http://www.networkupstools.org/doc/2.0.1/shutdown.html. Basically the
idea is to have the UPS shut down the power when it is safe for the computers,
but when the computers are still running. When the power comes back, the UPS
powers up again, and since the computers have not _halted_ completely, they
come back on line).


The first problem is that the Centos/RHEL 4.3 halt scripts umount the usbfs
needed by the ups. So the support seen in /etc/init.d/halt near the end
of the file will NOT WORK WITH USB UPS out of the box. LONG TERM SOLUTION:
fix the scripts to not umount usbfs (or wait after the call to the ups)

The second problem is that newhidups is not linked statically and it uses
libusb, that can be found on /usr on Centos/RHEL. Here is a ldd of
/sbin/newhidups from the opensource.mgeups.com site:
[user@xx ~]# ldd /sbin/newhidups
        libusb-0.1.so.4 => /usr/lib/libusb-0.1.so.4 (0x00c3a000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00658000)
        /lib/ld-linux.so.2 (0x0063f000)
Obviously, when /usr is umounted (when it is on another partition),
newhidups will not work... LONG TERM SOLUTION: link statically.

The third problem is that newhidups wants to 'do things' in /var/run
However, when /var is umounted (when it is on another partition),
newhidups will not work... LONG TERM SOLUTION: fail gracefully when
the command is -k, and shutdown anyway...


All those prevent the regular halt script to actually cut the load
from the UPS. It is not too bad though, because we have the possibility
to use the /sbin/halt.local hook.


I use the following /sbin/halt.local script now, and my shutdown process
works fine:

############BEGIN##################
#!/bin/bash

if [ -f /etc/killpower ] ; then
    # if USB is already disabled, re-enable it. (needed by newhidups)
    if [ ! -f /proc/bus/usb/devices ]; then
        echo "Mounting USB filesystem"
        mount -t usbfs usbfs /proc/bus/usb
    fi
    # newhidups is dynamically linked to libusb in /usr
    if [ ! -d /usr/lib ]; then
        echo "Mounting /usr filesystem read only"
        mount -o ro /usr
    fi
    # newhidups wants to go into /var/run
    if [ ! -d /var/run ]; then
        echo "Mounting /var filesystem read only"
        mount -o ro /var
    fi

    # hotplugging is probably off, so run driver as -u root
    echo "Killing the power, bye!"
    /sbin/newhidups -u root -k mgeups
    sleep 20

    # 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! ***
    echo "Killing the power failed ! (/sbin/halt.local)"
    sleep 20
    echo "Rebooting."
    reboot
fi
##################END##########################


I am pretty happy with the MGE Protection Center UPS hardware,
but the integration with Centos/RHEL is pretty bad currently,
and this is a shame. I hope my post will make things easier for
new users and in the future.


I would like to thank J.J.Garcia for his howto, and Arnaud
Quette from MGE (and current NUT maintainer) for his help.


--

Antoine Brenner
GymGlish
16A, bd de Reuilly
75012 Paris France
t / +33 (0) 1 53 33 02 40
f / +33 (0) 1 53 33 02 41
Learn English 10 minutes a day with GymGlish
http://www.gymglish.com/teaser



--- End Message ---
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux