1. There is a race condition in the low battery shutdown process. The intended sequence is that /etc/init.d/halt.sh will use /sbin/upsdrvctl to trigger a UPS shutdown. The UPS drops power, and the computer goes quiet. A while later the UPS will reapply power, and the machine will boot. The problem is that /sbin/upsdrvctl does not block, to wait for power to disappear. On a fast computer /sbin/upsdrvctl completes, /etc/init.d/halt.sh completes, and /etc/init.d/shutdown.sh is run..... /etc/init.d/shutdown.sh contains "/sbin/halt -idp". On most ATX pc hardware the "-p" switch will cause the system to power itself down, and stay down no matter what happens to the power supply. (and I assume something similar on other platforms). This is bad because we want the system to come back up under UPS control. I think it is a mistake for /etc/init.d/halt.sh to ever terminate in this scenario. It should block until power is switched off by the UPS. I propose this patch: ** halt.sh.original Mon Dec 30 16:19:45 2002 --- halt.sh Mon Dec 30 16:20:26 2002 *************** *** 139,146 **** --- 139,149 ---- if [ -f /etc/killpower -a -x /sbin/upsdrvctl ] then ewarn "Signalling ups driver(s) to kill the load!" /sbin/upsdrvctl shutdown + ewarn "Halt system and wait for the UPS to kill our power" + /sbin/halt -id + while [ 1 ]; do sleep 60; done fi 2. The deamon runs as the nut user/group. The default permissions on the config files mean that it can not respond to a SIGHUP, because this user can not read all the configuration files. It would be more convenient if the ebuild included: chgrp nut upsd.conf upsd.users upsmon.conf chmod g+r upsd.conf upsd.users upsmon.conf That would be more convenient, and only slightly less secure.
Not my domain.
wow, thank you *very much* for your analysis ... this is a wonderful catch, and i will address this as soon as i can.
Fixed, thanks again for the nice work. nut-1.2.1.ebuild fixes half the report, this commit to halt.sh fixes the other: http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-src/rc- scripts/init.d/halt.sh.diff?r1=1.25&r2=1.26 Az; see note in Changelog ;-)