Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 65211
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Michael Imhof <tantive@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Nathan Thompson <nthompson@thebog.net>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
apcupsd-3.14.2.ebuild Initial ebuild for 3.14.2 text/plain Chris Bandy 2007-10-06 03:49 0000 3.25 KB Details
apcupsd-3.14.2-apccontrol-gentoo.patch Updated patch for 3.14.2 text/plain Chris Bandy 2007-10-06 03:50 0000 401 bytes Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 65211 depends on: Show dependency tree
Bug 65211 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-09-24 08:02 0000
apcupsd'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 & 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.

------- Comment #1 From Michael Imhof 2005-09-05 05:48:00 0000 -------
If this problem still exists for apcupsd-3.10.18 then feel free to reopen this
bug.

------- Comment #2 From Jakub Moc (RETIRED) 2005-12-22 00:02:39 0000 -------
*** Bug 116349 has been marked as a duplicate of this bug. ***

------- Comment #3 From Jakub Moc (RETIRED) 2005-12-22 00:02:57 0000 -------
Still unfixed, reopen.

------- Comment #4 From Daniel 2005-12-29 04:50:50 0000 -------
(In reply to comment #3)
> Still unfixed, reopen.
> 
the same occurs here using 3.10.18-r1

--> /usr/sbin/apcupsd not found - which is clear, because /usr was unmounted
just before :-/

------- Comment #5 From Fernando Loureiro 2006-08-10 15:36:56 0000 -------
(In reply to comment #4)
> (In reply to comment #3)
> > Still unfixed, reopen.
> > 
> the same occurs here using 3.10.18-r1
> 
> --> /usr/sbin/apcupsd not found - which is clear, because /usr was unmounted
> just before :-/
> 

Is it already ok? =/

------- Comment #6 From Matteo Guglielmi 2007-02-17 18:26:09 0000 -------
(In reply to comment #0)

> 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).
> 

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

How did you modify the "halt.sh" 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. 

------- Comment #7 From CJ Kucera 2007-03-18 23:46:01 0000 -------
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'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

------- Comment #8 From CJ Kucera 2007-03-18 23:51:14 0000 -------
Well, looks like the most recent ~x86 (3.12.4) already does the
install-to-/sbin trick, so I guess I'll just move to that instead of putting
together a patch for this version.

------- Comment #9 From parafin 2007-06-27 18:37:55 0000 -------
It still doesn'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't see any possible solution to be honest, cause
you can't build apcupsd staticly, because it uses pthreads and you can'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's not a real solution.

------- Comment #10 From Chris Bandy 2007-10-06 03:47:52 0000 -------
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="-snmp" (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.

------- Comment #11 From Chris Bandy 2007-10-06 03:49:23 0000 -------
Created an attachment (id=132698) [details]
Initial ebuild

------- Comment #12 From Chris Bandy 2007-10-06 03:50:39 0000 -------
Created an attachment (id=132700) [details]
Updated patch for 3.14.2

------- Comment #13 From Michael Imhof 2007-11-26 08:18:41 0000 -------
In cvs.
Could you please check?

------- Comment #14 From Jakub Moc (RETIRED) 2008-02-13 00:34:42 0000 -------
*apcupsd-3.14.2 (26 Nov 2007)

  26 Nov 2007; Michael Imhof <tantive@gentoo.org>
  +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.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug