Bug 65211 - apcupsd cannot issue killpower command to UPS because /usr/sbin is no longer mounted
|
Bug#:
65211
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: tantive@gentoo.org
|
Reported By: nthompson@thebog.net
|
|
Component: Applications
|
|
|
URL:
|
|
Summary: apcupsd cannot issue killpower command to UPS because /usr/sbin is no longer mounted
|
|
Keywords:
|
|
Status Whiteboard:
|
|
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.
If this problem still exists for apcupsd-3.10.18 then feel free to reopen this
bug.
*** Bug 116349 has been marked as a duplicate of this bug. ***
(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 :-/
(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? =/
(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.
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.
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.
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.
In cvs.
Could you please check?
*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.