After going through several power outages recently I ordered UPSs for all our computers at home. The Linux boxes, running Ubuntu Edgy, ended with one APC ES 550 each.
APC UPSs are supported under Linux by the apcupsd daemon. Here are my notes on how I configured this daemon to work under Edgy. Make sure the UPS is all hooked up and that the USB cable is connected to your computer.
First install the package, its name is apcupsd. There is also a documentation package, apcupsd-doc, but the docs are incomplete and full of broken links. Just use the documentation from the official site if you need to.
Next, you need to configure the USB connection. The official documentation gives several solutions, depending on your kernel version and distro. Edgy is using udev and kernel 2.6.
The output of cat /proc/bus/usb/devices on my machine is:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#= 4 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 550 FW:840.B2.D USB FW:B2 S: SerialNumber=3B0637X46323 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=10ms
and the output of ls -l /sys/bus/usb/drivers/ is:
drwxr-xr-x 2 root root 0 2007-01-15 20:17 hiddev drwxr-xr-x 2 root root 0 2007-01-15 20:13 hub drwxr-xr-x 2 root root 0 2007-01-15 20:13 usb drwxr-xr-x 2 root root 0 2007-01-15 20:13 usbfs drwxr-xr-x 2 root root 0 2007-01-15 20:17 usbhid
Note: adding the 50-udev.rules files does not seem necessary anymore. Check first if you can see the /dev/hiddev0 device.
In order to get the device node you need to create the /etc/udev/rules.d/50-udev.rules file and add the following line to it:
BUS="usb", SYSFS{idVendor}="051d", NAME="usb/hiddev%n"After a restart the node will show up right under /dev as /dev/hiddev0.
And next you need to configure apcupsd, edit /etc/apcupsd/apcupsd.conf and make sure the following values are set (this is the Simple USB Configuration):
UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable
After this, as far as I can tell, you should be able to start the daemon (/etc/init.d/apcupsd) and everything should work. But the daemon kept throwing an error message:
Please check your configuration ISCONFIGURED in /etc/default/apcupsd
So, I just edited the above mentioned file and set ISCONFIGURED to yes instead of no. After that the daemon started fine. Not sure if I did the right thing, but so far everything works.
Once the daemon is running you can run apcaccess, the output in my case is:
APC : 001,034,0852 DATE : Mon Jan 15 21:09:35 PST 2007 HOSTNAME : pinguin RELEASE : 3.12.3 VERSION : 3.12.3 (26 April 2006) debian UPSNAME : pinguin CABLE : USB Cable MODEL : Back-UPS ES 550 UPSMODE : Stand Alone STARTTIME: Mon Jan 15 20:32:14 PST 2007 STATUS : ONLINE LINEV : 119.0 Volts LOADPCT : 0.0 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 46.9 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds LOTRANS : 088.0 Volts HITRANS : 139.0 Volts ALARMDEL : Always BATTV : 13.5 Volts LASTXFER : No transfers since turnon NUMXFERS : 0 TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A STATFLAG : 0x07000008 Status Flag MANDATE : 2006-09-07 SERIALNO : 3B0637X46323 BATTDATE : 2000-00-00 NOMBATTV : 12.0 FIRMWARE : 40.B2.D USB FW:B2 APCMODEL : Back-UPS ES 550 END APC : Mon Jan 15 21:09:44 PST 2007
Also, you can run apctest, but make sure you stop the daemon before you do that.
And now, the ultimate test: unplugging the UPS while your system is running. There are other tests you can perform, but it is much more fun to go for the real thing.
I was tailing /var/log/apcupsd.events and here is the output (please note that there are log entries mixed up with broadcast messages):
Broadcast Message from root@pinguin
(somewhere) at 21:17 ...
Warning power loss detected on UPS pinguin
Mon Jan 15 21:17:52 PST 2007 Power failure.
Mon Jan 15 21:17:58 PST 2007 Running on UPS batteries.
Broadcast Message from root@pinguin
(somewhere) at 21:17 ...
Power failure on UPS pinguin. Running on batteries.
Broadcast Message from root@pinguin
(somewhere) at 21:18 ...
Power has returned on UPS pinguin...
Mon Jan 15 21:18:01 PST 2007 Mains returned. No longer on UPS batteries.
Mon Jan 15 21:18:01 PST 2007 Power is back. UPS running on mains.
A nice surprise was that the Power Manager daemon detected the UPS automatically and its icon showed up in the notification area. Here are some screenshots:
![]()



Technorati Tags: 



hi,
is it normal that the ES 550 don't show any UPS Load?
STRKGN
Just thought I'd share again that this has worked with the latest Ubuntu upgrade, 8.04 LTS, "Hardy Heron".
Cheers!
HI (^_^)
Im still learning Ububtu - so go easy on me...
everything works fine up to apctest.
apctest FATAL ERROR in linux-usb.c at line 649
Cannot find UPS device --
and the apcupsd manual is Horrid !!!
..
the Power Manager Daemon does not see the ups
(mines a APC es 350 ups)
Any help would be greatly appreciated
thanks
Two things, first you have to run apctest as root, you are getting the above error most likely because you are running it as a regular user:
Second, you have to stop the apcupsd daemon before running apctest (and restart it when you are done):
Hope this helps,
Marius
I wrote below regarding how this post came just in time. I am back again because I have upgraded to 7.04. This once again worked for me, and worked on Fiesty! This helpful page should be the first hit off of google!
You da man!
Glad to know it works under Feisty, I will upgrade soon as well.
Thank you very much sir for this!.
It works great with the ES-550 on USB and Ubuntu Dapper Drake LTS.
Well this is sure a surprise, i thought I wouldnt find an apc daemon but Im repetitively surprised day after day with linux/ubuntu and thought to check around the net for a forum or article on this subject. Running UBU/Edgy. The UPS is a BX1500 APC Back-UPS with 865Watts capacity. Haven't received yet but will give it a shot, see if it works, or will have to tweak it to get it going. Looks like apcupsd is the only daemon available. is there another? Will this daemon support it?
Hope so. Would serve me well. & definitely be more to my benefit monitoring the UPS instead of having a Microsuck Winblows box with PowerCHUTE, bahh... Would be wasting more electricity.
-Support the Open Source Community-
Awesome post. Came just in time. I too decided to purchase the exact model you have and I am running 6.10. I was running 6.06 before my last power outage the week prior and it ended up corrupting files that I could not get back. Thus, I did a clean install-upgraded to Edgy and went to the local store but was dismayed when I found they only had Window's compatible UPS's. I decided to give it a try anyways and hopefully get lucky with a driver on the net, never thought I'd find a post or poster with the same issue a day later.
Cheers!
Last week I installed the same UPS on some other computer running Edgy and the /dev/hiddev0 device showed up right away, no need to create the 50-udev.rules file.
Also, checked the first computer and now the 50-udev.rules file was generating errors during bootup. I removed it and everything seems fine. Some kernel update must have made this obsolete. Not sure.