Name: Frequently Asked Questions
File: FAQ
Date: 20 November 1999

-----------------------------------------------------------------------------

 Q: My UPS-specific support program (apcsmart, genericups, etc) says 
    "Unable to open /dev/ttyxx".  I'm starting it as root and root owns
    the device, so why doesn't it work?

 A: The programs give up root _before_ they open the serial port.  So, you
    should change the permissions on the port around so that their   
    running userid can open it.  Typically this corresponds to the user
    "nobody".  If you use the --with-uid option to configure, it may be
    something else.

    Having a "ups" user that owns the serial port might not be such a bad
    idea...

-----------------------------------------------------------------------------

 Q: upsc, multimon, and the other programs give me "access denied".  The
    serial port permissions are fine, so what gives?

 A: Those programs only talk over the network.  That denied message is
    coming over it from upsd.  It's denying them since they don't have
    permission to talk to it according to the access controls.

    The fix is to edit the upsd.conf to allow those hosts to do what they
    need.  Simple things like upsstats and upsc only need "monitor" level
    security while upsmon needs "login" to be functional.

-----------------------------------------------------------------------------

 Q: I have a Smart-UPS connected with the grey APC cable and it won't
    work.  The Back-UPS type in the generic driver works but then I 
    don't get to use all the nifty features in there.  Why doesn't the 
    right driver work?

 A: The problem lies in your choice of cable.  APC's grey cables only do
    "dumb" signalling - very basic yes/no info about the battery and line
    status.  While that is sufficient to detect a low battery condition
    while on battery, you miss out on all the goodies that you paid for.

    The solution is to dump that cable and find one that supports APC's
    "smart" signalling.  Typically these come with the UPS and are black.
    If your smart cable has wandered off, they can be built rather easily
    with some connectors and cable - no fancy wiring or resistors.
    See this URL for a handy diagram:

    http://www.exploits.org/nut/library/940-0024C.jpg

    That should give you a workable clone of APC's 940-0024C cable.
    There are simpler solutions involving 3 wires that work just fine
    too, but Powerchute won't find the loopback DTR-DCD and RTS-CTS and
    will be annoyed.  If you don't ever plan to use Powerchute, 3 wires
    (RxD, TxD, GND) are sufficient.

    It should also be noted that the genericups driver has no way to detect
    the UPS, so it will fire up quite happily if it can open the serial
    port.  Merely having it start up is not necessarily an indication
    of success.  You should start it and then check the status with upsc
    or similar to be sure that it's reading the hardware properly.

-----------------------------------------------------------------------------

 Q: configure tells me to go get gd, but I have it installed!  Why isn't it
    finding the one I installed?

 A: Chances are, you have installed gd 1.6 (or higher) which includes PNG
    support and totally eliminates GIF.  But, you don't have the PNG libs
    on your system, so gd didn't compile them in.  So, you need to go get
    libpng, install that, recompile gd, THEN rerun configure.

    Start here: http://www.cdrom.com/pub/png/pngcode.html

 A: It seems like everyone and their brother has a different place for
    installing the gd includes and libraries.  If your system uses some
    bizarre location for these files, be sure to set the CPPFLAGS and CFLAGS
    accordingly with -L and -I arguments so that the linker and compiler
    can find everything.

-----------------------------------------------------------------------------

 Q: gd can't find zlib.h, so what do I do now?

 A: Go get zlib, install it, then try building gd again.

    Find zlib here: http://www.cdrom.com/pub/infozip/zlib/

-----------------------------------------------------------------------------

 Q: Now gd can't find png.h, so what do I need this time?

 A: libpng.  Get it, install it, and then start the gd make again...

    libpng is here: http://www.cdrom.com/pub/png/pngcode.html

-----------------------------------------------------------------------------

 Q: libpng doesn't seem to have a Makefile, so how do I build it on my
    Linux box?

 A: Besides "RTFM", perhaps you should copy scripts/makefile.lnx to
    Makefile (in the libpng directory) and then try it again.

-----------------------------------------------------------------------------

 Q: OK, I built libpng and gd, so why is configure saying "no (cached)"
    for the gdImagePng detection line?

 A: configure is being a bit too clever for its own good.  rm config.cache
    and rerun it and then it will figure out how things are setup now.

-----------------------------------------------------------------------------

 Q: My web browser used to be able to show the graphs, but then I upgraded
    NUT and it stopped.  Why?

 A: Some older browsers can't handle PNGs, and upsimage.cgi now uses those 
    exclusively.  You can either upgrade to a version that handles the PNG 
    format or hack the upsimage code to use an older version of gd.

    You really should find a newer browser, as GIF support is now gone.

-----------------------------------------------------------------------------

 Q: What about Y2K compliance and this software?

 A: Four programs in this package use dates as of this writing (24 August  
    1999) ... they are:

     - multimon
     - upsstats
     - upsmon
     - upslog

     These all derive a date string for display/logging purposes with
     strftime().  The year is generated by using %Y, which includes the
     century, rather than something bogus like "19%y".  If your system's
     strftime implementation is sane, then this will be too.

     upsd does refer to the system clock, but only for relative timing
     information by subtracting one returned value from a previous stored
     value.  This data is not turned into a date representation.  Some 
     problems may arise in January of 2038 if your system has not been 
     fixed to deal with the signed 32 bit number of seconds problem.

-----------------------------------------------------------------------------

  Q: My upsstats pages now have broken images where the bars used to be,
     and running upsimage.cgi by hand gives me something about libgd.so.0
     not being found.  How do I fix this?

  A: Some versions of gd used shared libraries.  The build process keeps
     going back and forth - autoconf driven vs. normal, shared vs. static - 
     so it's hard to say which version causes this.

     If your version is really using shared libraries, run ldconfig or
     its equivalent to rebuild the cache.  Then it should work.

-----------------------------------------------------------------------------
