

You raise an excellent question; unfortunately, it's one I don't have an answer to. I've observed identical behavior in all my UPS units (my stable currently includes one Back-UPS CS 350, one Back-UPS RS 1000, and two Back-UPS XS 800's). It's my off-the-cuff opinion that this functionality is probably limited to the higher-end Smart-UPS units; if I had one, I'd be happy to confirm or deny this theory. I'll do some digging and see if I can't find a definitive answer.suhlhorn wrote:Excellent HOW-TO!
Most everything went smoothly on the setup; just a couple of comments:
1) I had problems building usb support as a module with my 2.6 kernel. After making usb built-in, everything went smoothly.
2) The UPS unit does not appear to shut off via the 'killpower' option to apccontrol after the shutdown sequence has completed. Is this a limitation of my UPS (APC Back-Ups RS 1000) or a problem with the shutdown/halt scripts?
I waited a good 6 mins after the host shutdown for the UPS to 'killpower', but I had to turn it off by pressing the UPS power button. I'm assuming this has to happen for the UPS to correctly bring the computers back up when AC power returns.
UPDATE: I just noticed that the halt script looks for /etc/apcupsd/powerfail in order to killpower to the UPS. I just did a quick test and the file is not created when there is a loss of power. Looking through the apcupsd manual, it looks this should be taken care of by the /etc/apcupsd/poweroff or onbattery script:
http://www2.apcupsd.com/3.10.x-manual/shutdown.html



What youre asking is actually two separate things, so let me take them in turn:LodBot wrote:I do have one questions, though. How can I get my APC unit to turn my machine back on when power is restored? Right now, when the APC shuts down my system, gentoo hangs on the "Power Down" step of the shut down process. It doesn't actually power down. I guess what I'm asking is how can I get gentoo to shutdown without having to push the power button? I changed my BIOS last state setting so my system should turn back on when power is restored.

Code: Select all
root: ~ # ls /dev/usb/hid/h*
/dev/usb/hid/hiddev0
root: ~ # cat /proc/bus/usb/devices
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=051d ProdID=0002 Rev= 1.06
S: Manufacturer=APC
S: Product=Back-UPS ES 500 FW:2.e2.D USB FW:e2
S: SerialNumber=JB0312030497
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid
E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=10ms
(just a snip w/ the UPS data)
root: /proc/bus/usb # cat drivers
usbdevfs
hub
96-111: hiddev
hid
root: /usr/src/linux # grep -i usb .config
# CONFIG_INPUT_IFORCE_USB is not set
# USB support
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_BANDWIDTH is not set
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_UHCI_ALT=y
# CONFIG_USB_OHCI is not set
# CONFIG_USB_SL811HS_ALT is not set
# CONFIG_USB_SL811HS is not set
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_BLUETOOTH is not set
# CONFIG_USB_MIDI is not set
# CONFIG_USB_STORAGE is not set
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_DPCM is not set
# CONFIG_USB_STORAGE_HP8200e is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
CONFIG_USB_HID=y
CONFIG_USB_HIDINPUT=y
CONFIG_USB_HIDDEV=y
# CONFIG_USB_AIPTEK is not set
# CONFIG_USB_WACOM is not set
# CONFIG_USB_KBTAB is not set
# CONFIG_USB_POWERMATE is not set
# CONFIG_USB_DC2XX is not set
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_SCANNER is not set
# CONFIG_USB_MICROTEK is not set
# CONFIG_USB_HPUSBSCSI is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_CATC is not set
# CONFIG_USB_CDCETHER is not set
# CONFIG_USB_USBNET is not set
# CONFIG_USB_USS720 is not set
# USB Serial Converter support
# CONFIG_USB_SERIAL is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_AUERSWALD is not set
# CONFIG_USB_TIGL is not set
# CONFIG_USB_BRLVGER is not set
# CONFIG_USB_LCD is not set
# Support for USB gadgets
# CONFIG_USB_GADGET is not set
root: /usr/src/linux # grep -i apm .config
# CONFIG_APM is not set
root: /usr/src/linux # grep -i acpi .config
# ACPI Support
# CONFIG_ACPI is not set


Code: Select all
# shutdown h now





This is not true... before I followed the HOWTO, I had neither APM nor ACPI configured in my kernel, and a "halt" or "shutdown -h now" command powered off my machine with no further user intervention. If this shouldn't have been the case, maybe it's hardware specific? I dunno...whiskeypriest wrote:It's always been my understanding that either APM or ACPI was necessary for the system to power itself down without assistance.

Code: Select all
$ egrep -v "^#" /etc/apcupsd/apcupsd.conf
UPSCABLE usb
UPSTYPE usb
LOCKFILE /var/lock
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
Code: Select all
# apcupsd --version
apcupsd 3.10.15 (04 August 2004) gentoo

It's the latter: apcupsd signals that power has failed, but doesn't initiate the shutdown until ~20 minutes later. Actually, here's the snippet from /var/log/apcupsd.events:whiskeypriest wrote:For clarification: when running the final (full power failure, real-world test) did apcupsd initiate the shutdown on power failure, but the system delayed shutting itself down for ~20 minutes after the shutdown was issued? Or is it that the system ran on-battery for ~20 minutes before apcupsd issued the shutdown, when it should have run for ~75 minutes?
Code: Select all
Tue Oct 05 22:10:54 CDT 2004 Power failure.
Tue Oct 05 22:11:00 CDT 2004 Running on UPS batteries.
Tue Oct 05 22:43:17 CDT 2004 Reached remaining time percentage limit on batteries.
Tue Oct 05 22:43:17 CDT 2004 Initiating system shutdown!
Tue Oct 05 22:43:17 CDT 2004 User logins prohibited
Tue Oct 05 22:43:19 CDT 2004 apcupsd exiting, signal 15
Tue Oct 05 22:43:19 CDT 2004 apcupsd shutdown succeeded
I run dnetc, which keeps my processors at 100% (don't want to lose those spare cycles now, do we??). AFAIK there wasn't any heavy disk activity when the anomaly occurred. I'm gonna start the second test now, and I'm even gonna tax it more by burning a PHLAK ISO... That will probably bring it down faster, so I'll need to keep an eye on things... Seems burning only increases my UPS load by 3%...whiskeypriest wrote:I'm used to seeing some Out of curiosity, you weren't doing anything that might have spiked the processors during that last test, were you? Obviously, my system has a bit less runtime if I'm compiling something monstrous or playing UT2K4 than it does when I'm basically idle. Just another thought.

Thanks, I found it on my own. I need to learn how to look harder. Of course, I couldn't find any posts with my own problem.whiskeypriest wrote:Try this link...should take you to the search page for apcupsd-users at SF.
Code: Select all
# cat /etc/apcupsd/doshutdown
#!/bin/sh
BCHARGE=`/usr/sbin/apcaccess status | grep "BCHARGE"`
TIMELEFT=`/usr/sbin/apcaccess status | grep "TIMELEFT"`
echo `date` ${BCHARGE} >> /var/log/apcupsd.events
echo `date` ${TIMELEFT} >> /var/log/apcupsd.events
exit 0
Code: Select all
Thu Oct 07 23:32:54 CDT 2004 Power failure.
Thu Oct 07 23:33:00 CDT 2004 Running on UPS batteries.
Fri Oct 08 00:23:57 CDT 2004 Reached remaining time percentage limit on batteries.
Fri Oct 08 00:23:57 CDT 2004 Initiating system shutdown!
Fri Oct 08 00:23:57 CDT 2004 User logins prohibited
Fri Oct 8 00:23:57 CDT 2004
BCHARGE : 031.0 Percent
TIMELEFT : 0.0 Minutes
Fri Oct 08 00:23:58 CDT 2004 apcupsd exiting, signal 15
Fri Oct 08 00:23:58 CDT 2004 apcupsd shutdown succeeded

Code: Select all
Sun Oct 10 10:17:32 CDT 2004 Power failure.
Sun Oct 10 10:17:38 CDT 2004 Running on UPS batteries.
Sun Oct 10 10:32:03 CDT 2004 Reached remaining time percentage limit on batteries.
Sun Oct 10 10:32:03 CDT 2004 Initiating system shutdown!
Sun Oct 10 10:32:03 CDT 2004 User logins prohibited
Sun Oct 10 10:32:04 CDT 2004 BCHARGE : 090.0 Percent
Sun Oct 10 10:32:04 CDT 2004 TIMELEFT : 0.0 Minutes
Sun Oct 10 10:32:07 CDT 2004 apcupsd exiting, signal 15
Sun Oct 10 10:32:07 CDT 2004 apcupsd shutdown succeeded