Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112506 - unable to completely power off using apcupsd with normal inint.d scripts
Summary: unable to completely power off using apcupsd with normal inint.d scripts
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-14 06:24 UTC by Francisco Ares
Modified: 2010-04-09 22:37 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francisco Ares 2005-11-14 06:24:30 UTC
I guess this can be a configuration problem, but I could not find where, have
tried all of them.

I'm using a APC ES600, and although some numerical values given by "powerflute"
are odd, the logical commands and answers and battery level value are OK.

There is a workaround: not using the init.d script at all and starting the
service in "local" or whatever, or still removing the "stop" part of the init.d
script.

Reproducible: Always
Steps to Reproduce:
1. configure /etc/apcupsd/apcupsd with either a TIMEOUT, MINUTES or BATTERYLEVEL
2. restart the daemon issuing a /etc/init.d/apcupsd restart
3. unplug the UPS mains

Actual Results:  
When I unplug the UPS, the system waits to the configured remaining battery
level and then it goes to a halt state (does not power down the computer power
supply as a normal shutdown would), but the UPS does not switch off the mains,
no matter how much I left the system on - it only switches off when the battery
completelly runs out of charge.

Expected Results:  
UPS power switched off

if I start the service manually as root issuing a 

/usr/sbin/apcupsd -p

it does the job, i.e., it shuts down the system and after a while it switches
off the UPS power.

I could see that when a power fail condition occurs, there's no "powerfail" file
in /etc/apcupsd/ as expected reading the documentation.

I guess there should be another init.d scrip for the final shutdown command:

apccontroll --killpower


Follows "emerge info" details:
Portage 2.0.51.22-r3 (default-linux/x86/2005.0, gcc-3.3.6, glibc-2.3.5-r2,
2.6.13-gentoo-r3 i686)
=================================================================
System uname: 2.6.13-gentoo-r3 i686 Pentium III (Coppermine)
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [disabled]
dev-lang/python:     2.2.3-r6, 2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium3 -mcpu=pentium3 -fprefetch-loop-arrays -funroll-loops
-pipe -mmmx -msse"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -mcpu=pentium3 -fprefetch-loop-arrays
-funroll-loops -pipe -mmmx -msse -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg distcc distlocks fixpackages nodoc notitles
sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.osuosl.org/"
LANG="pt_BR"
LC_ALL="pt_BR"
LINGUAS="pt_BR"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 X alsa apm audiofile avi bash-completion berkdb bitmap-fonts bootsplash
bzip2 cdparanoia cdr crypt cups curl directfb dvb dvd dvdread eds emboss encode
exif expat fam flash foomaticdb fortran gd gdbm ggi gif glut gpm gstreamer gtk
gtk2 guile idn imagemagick imlib java jbig jpeg jpeg2k lcms ldap libg++ libwww
lzw-tiff mad mhash mikmod ming mmx mmx2 mng motif mozilla mp3 mpeg nas ncurses
nls nptl nptlonly odbc ogg oggvorbis opengl pam pcre pdflib perl png python
quicktime readline real recode samba sdl snmp spell sse ssl svga tcltk tcpd
tetex tga threads tif tiff truetype truetype-fonts type1-fonts udev unicode
vorbis wmf xml xml2 xmms xprint xv xvid zlib linguas_pt_BR userland_GNU
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, PORTDIR_OVERLAY
Comment 1 Lorenz Kiefner 2005-12-27 11:40:22 UTC
There is another case related to this: When shutting down my system the halt.sh-script doesn't power off the UPS.

I think line 172 in halt.sh (baselayout 1.11.13-r1) should check for  /etc/apcupsd/apccontrol instead of /etc/apcupsd/powerfail.

I use a APC Back-UPS BF350, Keyword is "x86"
Comment 2 Christian Hartmann (RETIRED) gentoo-dev 2006-08-18 02:57:41 UTC
Seems to be related to bug 65211
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-01-15 15:23:20 UTC
Taking over. Michael you let this package rot so much, since I need it, I'm going to take it over and take care.

Please don't say I didn't give you enough notice, last year I already asked you this much and now I'm simply tired.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-01-15 15:42:31 UTC
Can you please test to see if this is still a problem with current systems? I think it should power off completely by now.
Comment 5 Ronny Bull 2010-04-09 22:21:29 UTC
This is still happening on 3.14.7 and 3.14.8.  I have set up apcupsd in a masater/slave fashion, and all 4 of my gentoo boxes get to the point of a system halt but do not power down.  I have an endian firewall that I installed apcupsd on and it powers down completely when instructed to by the master.  All 4 of the gentoo boxes shutdown properly when using the shutdown -h now command, as well as when I just press the power button.(In reply to comment #4)
> Can you please test to see if this is still a problem with current systems? I
> think it should power off completely by now.
> 

Comment 6 Ronny Bull 2010-04-09 22:37:30 UTC
I was able to get my machine to power off by changing the following in /etc/init.d/halt.sh

seems like a dirty hack but it works:

I changed this:

if [[ -x ${UPS_CTL} ]] ; then
                ewarn "Signalling ups driver(s) to kill the load!"
                ${UPS_POWERDOWN}
                ewarn "Halt system and wait for the UPS to kill our power"
                /sbin/halt -id
                while [ 1 ]; do sleep 60; done
                
        fi


To this:
if [[ -x ${UPS_CTL} ]] ; then
                ewarn "Signalling ups driver(s) to kill the load!"
                ${UPS_POWERDOWN}
                ewarn "Halt system and wait for the UPS to kill our power"
                #/sbin/halt -id
                #while [ 1 ]; do sleep 60; done
                /sbin/shutdown -h now

        fi