Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 12947 - several net-misc/nut-1.0.0 issues
Summary: several net-misc/nut-1.0.0 issues
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Donny Davies (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-30 11:02 UTC by Toby Dickenson
Modified: 2003-01-27 22:09 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 Toby Dickenson 2002-12-30 11:02:35 UTC
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.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-31 16:38:13 UTC
Not my domain.
Comment 2 Donny Davies (RETIRED) gentoo-dev 2002-12-31 19:14:29 UTC
wow, thank you *very much* for your analysis ...

this is a wonderful catch, and i will address this as soon as i can.
Comment 3 Donny Davies (RETIRED) gentoo-dev 2003-01-27 22:09:18 UTC
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 ;-)