<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>65211</bug_id>
          
          <creation_ts>2004-09-24 08:02 0000</creation_ts>
          <short_desc>apcupsd cannot issue killpower command to UPS because /usr/sbin is no longer mounted</short_desc>
          <delta_ts>2008-02-13 00:34:42 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>nthompson@thebog.net</reporter>
          <assigned_to>tantive@gentoo.org</assigned_to>
          <cc>anotherbearcatfan@yahoo.com</cc>
    
    <cc>bakirov@transfer.kg</cc>
    
    <cc>demerss@gmail.com</cc>
    
    <cc>diogot@gmail.com</cc>
    
    <cc>help@imtrappedininter.net</cc>
    
    <cc>ladanyi@tmit.bme.hu</cc>
    
    <cc>littleslash@mail.ru</cc>
    
    <cc>loureiro.fernando@gmail.com</cc>
    
    <cc>pez@apocalyptech.com</cc>

      

      
          <long_desc isprivate="0">
            <who>nthompson@thebog.net</who>
            <bug_when>2004-09-24 08:02:25 0000</bug_when>
            <thetext>apcupsd&apos;s ebuild (3.10.13 and 3.10.15-r1) configure the sbin directory to be in /usr/sbin rather than /sbin and loggging to be in /var/log rather than /etc/apcupsd.  This is fine for normal operations, but when a power failure occurs and the ups batteries become exhasted, the killpower command can not be run if /usr and/or /var are separate mountpoints from root (/).

Note that I have modifed /etc/init.d/halt.sh to include essentially the code in /etc/init.d/halt at the end of the file (after unmounting and remounting root read-only).

Reproducible: Always
Steps to Reproduce:
1. Configure drive partitions to have separate mount points for {/,/usr,/var}
2. emerge &amp; configure apcupsd
3. unplug power from UPS, let batteries drain
4. When apcupsd shuts down the system /usr and /var are unmounted
5. code at end of halt.sh issues command `/etc/apcupsd/apccontrol killpower`
6. previous command tries to call `/usr/sbin/apcupsd --killpower` but /usr is no longer mounted. (and if you copy apcupsd to /sbin it will bomb out because it cannot log to /var/log/apcupsd.events).

Actual Results:  
/usr/sbin/apcupsd does not exist (because /usr is not mounted).  Results in UPS
never being powered down.

Expected Results:  
issued killpower command to UPS, resulting in UPS turning itself off.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>tantive@gentoo.org</who>
            <bug_when>2005-09-05 05:48:00 0000</bug_when>
            <thetext>If this problem still exists for apcupsd-3.10.18 then feel free to reopen this bug.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-12-22 00:02:39 0000</bug_when>
            <thetext>*** Bug 116349 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-12-22 00:02:57 0000</bug_when>
            <thetext>Still unfixed, reopen.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>deepee@gmx.net</who>
            <bug_when>2005-12-29 04:50:50 0000</bug_when>
            <thetext>(In reply to comment #3)
&gt; Still unfixed, reopen.
&gt; 
the same occurs here using 3.10.18-r1

--&gt; /usr/sbin/apcupsd not found - which is clear, because /usr was unmounted just before :-/</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>loureiro.fernando@gmail.com</who>
            <bug_when>2006-08-10 15:36:56 0000</bug_when>
            <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; Still unfixed, reopen.
&gt; &gt; 
&gt; the same occurs here using 3.10.18-r1
&gt; 
&gt; --&gt; /usr/sbin/apcupsd not found - which is clear, because /usr was unmounted
&gt; just before :-/
&gt; 

Is it already ok? =/</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>matteo.guglielmi@epfl.ch</who>
            <bug_when>2007-02-17 18:26:09 0000</bug_when>
            <thetext>(In reply to comment #0)

&gt; Note that I have modifed /etc/init.d/halt.sh to include essentially the code in
&gt; /etc/init.d/halt at the end of the file (after unmounting and remounting root
&gt; read-only).
&gt; 

The same problem here (/usr, /var, /home, /tmp and /opt on LVM2).

How did you modify the &quot;halt.sh&quot; script in order to mount readonly /usr?

And what about the log file /var/log/apcupsd.events? Is there any problem with apcupsd if he cannot access it?

Thanks. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pez@apocalyptech.com</who>
            <bug_when>2007-03-18 23:46:01 0000</bug_when>
            <thetext>Yeah, I just ran into this too.  It seems like apcupsd is the kind of executable that should really be going into /sbin anyway...  Seems like that&apos;d be a pretty quick fix, and that seems to be the recommended installation method, a la: http://www.apcupsd.org/manual/Building_Installing_apcupsd.html#SECTION000115000000000000000</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pez@apocalyptech.com</who>
            <bug_when>2007-03-18 23:51:14 0000</bug_when>
            <thetext>Well, looks like the most recent ~x86 (3.12.4) already does the install-to-/sbin trick, so I guess I&apos;ll just move to that instead of putting together a patch for this version.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>help@imtrappedininter.net</who>
            <bug_when>2007-06-27 18:37:55 0000</bug_when>
            <thetext>It still doesn&apos;t work even with binary in /sbin, because it linked with libstdc++ (and one more library), which is located in (yeah, you guessed it) /usr. See bug #178931. I don&apos;t see any possible solution to be honest, cause you can&apos;t build apcupsd staticly, because it uses pthreads and you can&apos;t switch it off. Is there a way to staticly link only some libraries to executable?
Anyway, there is a quick workaround:
1. mkdir /root/root ; mount --bind / /root/root
2. mkdir /root/root/usr/lib ; cp -a /usr/lib/gcc /root/root/usr/lib/
3. umount /root/root ; rmdir /root/root
Now it works fine, but it&apos;s not a real solution.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>cbandy@jbandy.com</who>
            <bug_when>2007-10-06 03:47:52 0000</bug_when>
            <thetext>good news: apcupsd-3.14.2 no longer links to libstdc++

it does however link to libnetsnmp and libcrypt (both in /usr/lib), but only with certain configure arguments / use variables.

setting USE=&quot;-snmp&quot; (configure --disable-net-snmp) appears to remove this dependency and allow apcupsd to run with /usr unmounted, i.e. power-down the battery during shutdown.

No alteration of halt.sh is required. I did not try EVERY combination of USE variables, so if you find a build parameter that links user libs again please post your results.

I will attach the updated ebuild and new patch I used. Other patches are from 3.14.1 in portage.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>cbandy@jbandy.com</who>
            <bug_when>2007-10-06 03:49:23 0000</bug_when>
            <thetext>Created an attachment (id=132698)
Initial ebuild

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>cbandy@jbandy.com</who>
            <bug_when>2007-10-06 03:50:39 0000</bug_when>
            <thetext>Created an attachment (id=132700)
Updated patch for 3.14.2

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>tantive@gentoo.org</who>
            <bug_when>2007-11-26 08:18:41 0000</bug_when>
            <thetext>In cvs.
Could you please check?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2008-02-13 00:34:42 0000</bug_when>
            <thetext>*apcupsd-3.14.2 (26 Nov 2007)

  26 Nov 2007; Michael Imhof &lt;tantive@gentoo.org&gt;
  +files/3.14.2/apcupsd.in.patch, +files/3.14.2/apcupsd.initd,
  +files/3.14.2/etc.patch, +files/3.14.2/no-parallel.patch,
  +apcupsd-3.14.2.ebuild:
  Version bump. Closes #65211, #197022.
</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>132698</attachid>
            <date>2007-10-06 03:49 0000</date>
            <desc>Initial ebuild for 3.14.2</desc>
            <filename>apcupsd-3.14.2.ebuild</filename>
            <type>text/plain</type>
            <data enc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C5kL2FwY3Vwc2QgdG8g
YSBuZXciCgllbG9nICIvZXRjL2luaXQuZC9hcGN1cHNkLnNvbWV0aGluZywgYW5kIGl0IHdpbGwg
dGhlbiBsb2FkIHRoZSIKCWVsb2cgImNvbmZpZ3VyYXRpb24gZmlsZSBhdCAvZXRjL2FwY3Vwc2Qv
c29tZXRoaW5nLmNvbmYuIgoJZWxvZyAiIgp9Cgpwa2dfcHJlcm0oKSB7Cgl1c2UgY2dpICYmIHdl
YmFwcF9wa2dfcHJlcm0KfQo=
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>132700</attachid>
            <date>2007-10-06 03:50 0000</date>
            <desc>Updated patch for 3.14.2</desc>
            <filename>apcupsd-3.14.2-apccontrol-gentoo.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">SW5kZXg6IGFwY3Vwc2QtMy4xNC4yL3BsYXRmb3Jtcy9hcGNjb250cm9sLmluCj09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K
LS0tIGFwY3Vwc2QtMy4xNC4yLm9yaWcvcGxhdGZvcm1zL2FwY2NvbnRyb2wuaW4KKysrIGFwY3Vw
c2QtMy4xNC4yL3BsYXRmb3Jtcy9hcGNjb250cm9sLmluCkBAIC0xOCw3ICsxOCw3IEBACiBwcmVm
aXg9QHByZWZpeEAKIGV4ZWNfcHJlZml4PUBleGVjX3ByZWZpeEAKIAotQVBDUElEPUBQSURESVJA
L2FwY3Vwc2QucGlkCitTRVJWSUNFPSR7U0VSVklDRS1hcGN1cHNkfQogQVBDVVBTRD1Ac2JpbmRp
ckAvYXBjdXBzZAogU0hVVERPV049QFNIVVRET1dOQAogU0NSSVBUU0hFTEw9QFNDUklQVFNIRUxM
QAo=
</data>        

          </attachment>
    </bug>

</bugzilla>