I recently bought 2 of those UPS devices from APC (model RS-550). I was impressed how APC supports Linux systems with source code for the daemon and a GUI control tool. Thumbs up for them. There is even a package in the openSUSE standard repo. However, it’s still ver. 3.14.6, so I thought I would build the latest release.
Basically all went well. I just had to adapt the patches to the new version. It builds for 11.1 and for 11.2 (which I use) and works perfect. Unfortunately it did not build for 11.3. I hope with some help from the community we can make it a package for all 11.3 users too.
This is the issue: The build for 11.3 fails during the configure step when looking for the shutdown command. The log says:
checking for gawk... gawk
checking for library containing strerror... none required
checking for shutdown... no
checking for shutdown.bsd... no
configure: error: Missing required tool; need any one of: shutdown shutdown.bsd
error: Bad exit status from /var/tmp/rpm-tmp.DDCThN (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.DDCThN (%build)
SysRq : Power Off
Power down.
I can’t find a reason why 11.3 fails here. configure.in specifies:
dnl Now check for programs
AC_REQ_PATH_PROGS(SHUTDOWN, shutdown shutdown.bsd)
and this leads to the following tests in configure (indentation edited to make it readable):
for ac_prog in shutdown shutdown.bsd
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_SHUTDOWN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $SHUTDOWN in
\\/]* | ?:\\/]*)
ac_cv_path_SHUTDOWN="$SHUTDOWN" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_SHUTDOWN="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
SHUTDOWN=$ac_cv_path_SHUTDOWN
if test -n "$SHUTDOWN"; then
echo "$as_me:$LINENO: result: $SHUTDOWN" >&5
echo "${ECHO_T}$SHUTDOWN" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$SHUTDOWN" && break
done
if test "$SHUTDOWN" = "" ; then
{ { echo "$as_me:$LINENO: error: Missing required tool; need any one of: shutdown shutdown.bsd" >&5
echo "$as_me: error: Missing required tool; need any one of: shutdown shutdown.bsd" >&2;}
{ (exit 1); exit 1; }; }
fi
Hi
Created request id 45852, added sysvinit to build requires, still fails
but looks like you have some patching to do… You could try
exporting the compiler flags to use an earlier version of gcc?
You could just have accepted and it would have updated your spec
Amazing; I didn’t know that this feature even exists. Good for next time.
Do you need snmp? If not, just disable in the configure?
No, I do not need it. My case is a simple 1 computer to 1 UPS setup, connected via USB. And it is 11.2 which builds and works fine. But I thought that when I build, then I should build for others too, who might use 11.3. But I am very reluctant to publish a build with snmp disabled; people might jump on the newer version number and miss features they possibly need, instead of using apcupsd-3.14.6 which works. Even better to disable the 11.3 build when I can’t get it right. But I’m not giving up yet. My next task is to have a look at the compiler flags, as you suggested.
Hi
Yup just using osc from my machine here, it’s much quicker to build locally and iron ot the bugs before building on OBS. I just branched your package and built here. You should try it…?
Eventually I will do so. But for now I am sitting in my branch office south of the Alps where I have a beautiful view on the lake but very limited hardware. I assume that I need a good 11.3 install to use osc for 11.3 builds.
Hi
No, by default it will build factory. My system doesn’t have VT so I just use a chroot environment. Either a reasonable download speed, or iso’s of the platform your wanting to build to cache the rpms is the only limitation. The only thing is if you have 32bit, you can only build 32bit. 64bit can build either. For example to build yours as 32bit it would be;
Wow, you guys are amazing (malcolmlewis & vodoo). I am impressed a lot. Should you need a volunteer to test your new compiled version, just let me know how to get it. I can try it out on a couple of APC units. But you got to be quick, as I will be off line for a few weeks in the near future.
That did it and it works just fine. I checked the version and it says 3.14.8 as it should. To install the files I added the repository you gave me, but first I shutdown the gui and stopped the apc service. I then updated both apc files in Software Management using the versions tab, restarted the service and reloaded the gui. It seems to working like a champ. Is there anything specific I should look for or is just working fine good enough?
It seems to working like a champ. Is there anything specific I should look for or is just working fine good enough?
Not good enough at all. The crucial point is what happens when your system is going down after a long power outage. I strongly suggest to run the tests described in APCUPSD User Manual.
As far as I can see so far it will fail miserably due to a bug. This is what probably happens: the deamon will shut the system down according to the configuration in /etc/apcupsd/apcupsd.conf and will be killed itself like any other process. So far, so good.
In the script /etc/init.d/halt you should find a line close to the end:
test -n "$HALT_POWERDOWN_INSERT" && $HALT_POWERDOWN_INSERT
This is defined in /etc/sysconfig/shutdown and executes:
/etc/init.d/apcupsd try-powerdown
which in turn executes:
if test "$RUNLEVEL" = "0" -a -f /etc/apcupsd/powerfail ; then
exec $0 powerdown
fi
where $0 expands to /etc/init.d/apcupsd. It calls itself again, but his time with the ‘powerdown’ argument. It does:
Look at the very beginning of /etc/init.d/apcupsd. You will see:
APCUPSD_LITE=/usr/sbin/apcupsd-lite
but apcupsd-lite is installed as /sbin/apcupsd-lite. The bug is the wrong path in the /etc/init.d/apcupsd init script. apcupsd-lite was correctly moved to /sbin in order to make it available even when /usr has already been umounted. But probably someone forgot to adapt the init script as well. This has possibly been broken for a long time (since sept. 2006). I will fix this in my build (on my todo list).
Why is all of this essential? It is not just good enough to bring the system down upon a power outage when batteries are weak. The UPS must be instructed to cut the power to the computer just before the kernel is brought down (sounds brutal) and go into hibernate mode (the UPS is hibernating, the PC is just dead and powerless). This gives you the possibility to set your BIOS to start the computer again when power is restored. As soon as there is power available the sleeping UPS will wake up and will power up the computer making it boot. This is a very good thing for unattended servers, where no one will push the start button after a poweroff.
I got the new update and I will try to test this on the weekend. I am down to a few days before I will be offline, but I will give this a priority this weekend.