You are not logged in.

#1 2012-11-08 21:08:37

frojnd
Member
Registered: 2008-09-20
Posts: 114

[Solved] APC UPS - systemd daemon not active

Hi there.

Today I switch entirely to systemd and I love it so far, it's simple robust and efficient!

However I found one problem when running $ systemctl --failed

UNIT            LOAD   ACTIVE SUB    JOB DESCRIPTION
apcupsd.service loaded failed failed     APC UPS Monitor

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
JOB    = Pending job for the unit.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

So I ran sudo systemctl status apcupsd.status for more detailed output:

apcupsd.service - APC UPS Monitor
	  Loaded: loaded (/usr/lib/systemd/system/apcupsd.service; enabled)
	  Active: failed (Result: exit-code) since Thu, 2012-11-08 20:49:19 CET; 1h 3min ago
	Main PID: 275 (code=exited, status=1/FAILURE)
	  CGroup: name=systemd:/system/apcupsd.service

Nov 08 20:49:19 traktor apcupsd[275]: apcupsd FATAL ERROR in linux-usb.c at line 609
Nov 08 20:49:19 traktor apcupsd[275]: Cannot find UPS device --
Nov 08 20:49:19 traktor apcupsd[275]: For a link to detailed USB trouble shooting information,
Nov 08 20:49:19 traktor apcupsd[275]: please see <http://www.apcupsd.com/support.html>.
Nov 08 20:49:19 traktor systemd[1]: apcupsd.service: main process exited, code=exited, status=1/FAILURE
Nov 08 20:49:19 traktor systemd[1]: Unit apcupsd.service entered failed state

I've checked lsusb:

Bus 005 Device 007: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

Device is obvious there...

I've then tailed dmesg:

[  640.044762] usb 5-1.1: new low-speed USB device number 7 using ehci_hcd
[  641.763703] hid-generic 0003:051D:0002.0003: hiddev0,hidraw0: USB HID v1.10 Device [American Power Conversion Back-UPS CS 650 FW:817.v8.I USB FW:v8] on usb-0000:00:1d.0-1.1/input0

And since device is recognized I went to http://www.apcupsd.com/support.html more specifically: http://www.apcupsd.org/manual/manual.ht … figuration
Under troubleshooting couldn't find anything suspecios except under http://www.apcupsd.org/manual/manual.ht … usb-issues

I assume all usb devices are in /proc/bus/input/devices:

$ cat /proc/bus/input/
devices   handlers  
[frojnd@traktor ~]$ cat /proc/bus/input/devices 
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input0
U: Uniq=
H: Handlers=kbd event0 
B: PROP=0
B: EV=120013
B: KEY=402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input1
U: Uniq=
H: Handlers=kbd event1 
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/devices/platform/pcspkr/input/input3
U: Uniq=
H: Handlers=kbd event3 
B: PROP=0
B: EV=40001
B: SND=6

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Eee PC WMI hotkeys"
P: Phys=eeepc-wmi/input0
S: Sysfs=/devices/platform/eeepc-wmi/input/input4
U: Uniq=
H: Handlers=kbd event4 rfkill 
B: PROP=0
B: EV=100013
B: KEY=7e40000 0 800000000000 0 0 1400800100000 300180001100800 e000000000000 2
B: MSC=10

I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input5
U: Uniq=
H: Handlers=kbd event5 
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input6
U: Uniq=
H: Handlers=event6 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Line"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input7
U: Uniq=
H: Handlers=event7 
B: PROP=0
B: EV=21
B: SW=2000

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Front Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input8
U: Uniq=
H: Handlers=event8 
B: PROP=0
B: EV=21
B: SW=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Rear Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input9
U: Uniq=
H: Handlers=event9 
B: PROP=0
B: EV=21
B: SW=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Front Headphone"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input10
U: Uniq=
H: Handlers=event10 
B: PROP=0
B: EV=21
B: SW=4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Line Out Side"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input11
U: Uniq=
H: Handlers=event11 
B: PROP=0
B: EV=21
B: SW=40

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Line Out CLFE"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input12
U: Uniq=
H: Handlers=event12 
B: PROP=0
B: EV=21
B: SW=40

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Line Out Surround"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input13
U: Uniq=
H: Handlers=event13 
B: PROP=0
B: EV=21
B: SW=40

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Line Out Front"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input14
U: Uniq=
H: Handlers=event14 
B: PROP=0
B: EV=21
B: SW=40

I: Bus=0003 Vendor=046d Product=0990 Version=0008
N: Name="UVC Camera (046d:0990)"
P: Phys=usb-0000:00:1d.0-1.6.1/button
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1.6/5-1.6.1/5-1.6.1:1.0/input/input15
U: Uniq=
H: Handlers=kbd event15 
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0

I: Bus=0003 Vendor=046d Product=c01d Version=0110
N: Name="Logitech USB-PS/2 Optical Mouse"
P: Phys=usb-0000:00:1d.0-1.5/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1.5/5-1.5:1.0/input/input16
U: Uniq=
H: Handlers=mouse0 event16 
B: PROP=0
B: EV=17
B: KEY=ff0000 0 0 0 0
B: REL=103
B: MSC=10

No sign of APC UPS there

apcaccess status gives me error:

Error contacting apcupsd @ localhost:3551: Connection refused

BUT when running apctest it works:

$ sudo apctest 


2012-11-08 21:32:30 apctest 3.14.10 (13 September 2011) unknown
Checking configuration ...
Attached to driver: usb
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...

You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.

Getting UPS capabilities...SUCCESS

Please select the function you want to perform.

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 11

Testing alarm...COMPLETE

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 2


This test instructs the UPS to perform a self-test
operation and reports the result when the test completes.

Clearing previous self test result...CLEARED
Initiating self test...INITIATED
Waiting for test to complete...COMPLETED
Result of last self test: PASSED

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 4

Current battery date: 10/28/2011
Enter new battery date (MM/DD/YYYY), blank to quit: 

Invalid format.

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 5

Manufacturing date: 10/28/2011

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 7

Current sensitivity setting: MEDIUM
Press...
 L for Low sensitivity
 M for Medium sensitivity
 H for High sensitivity
 Q to Quit with no changes
Your choice: Select function: q


1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: q

2012-11-08 21:34:50 End apctest.

How can I get to work apcupsd so I can see how many minutes I have left after power goes down?

I have latest stock kernel: 3.6.6-1-ARCH, apcupsd Version 3.14.10-3 and this is my /etc/apcupsd/apcupsd.conf

UPSCABLE usb
UPSTYPE usb
DEVICE /dev/usb/hid/hiddev[[0-15]]
LOCKFILE /etc/apcupsd
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
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

Any ideas how can I get my ups properly to work?

Last edited by frojnd (2012-11-14 19:42:28)

Offline

#2 2012-11-10 22:43:04

frojnd
Member
Registered: 2008-09-20
Posts: 114

Re: [Solved] APC UPS - systemd daemon not active

Today I've rechecked systemctl status  apcupsd.service and to my surprise I saw this:

$ sudo systemctl status apcupsd.service
apcupsd.service - APC UPS Monitor
	  Loaded: loaded (/usr/lib/systemd/system/apcupsd.service; enabled)
	  Active: active (running) since Sat, 2012-11-10 15:04:21 CET; 8h ago
	Main PID: 332 (apcupsd)
	  CGroup: name=systemd:/system/apcupsd.service
		  └ 332 /sbin/apcupsd -b

Nov 10 15:04:21 hoster systemd[1]: Starting APC UPS Monitor...
Nov 10 15:04:21 hoster systemd[1]: Started APC UPS Monitor.
Nov 10 15:04:26 hoster apcupsd[332]: apcupsd 3.14.10 (13 September 2011) unknown startup succeeded
Nov 10 15:04:26 hoster apcupsd[332]: NIS server startup succeeded

As you can see under "Active:" there is active (running)

I then try apcacaccess status:

$ sudo apcaccess status
[sudo] password for frojnd: 
APC      : 001,045,1105
DATE     : 2012-11-10 23:31:57 +0100  
HOSTNAME : traktor
VERSION  : 3.14.10 (13 September 2011) unknown
UPSNAME  : hoster
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2012-11-10 15:04:21 +0100  
MODEL    : Back-UPS CS 650 
STATUS   : ONLINE 
LINEV    : 234.0 Volts
LOADPCT  :  20.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  24.5 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 230.0 Volts
SENSE    : Medium
DWAKE    : 000 Seconds
DSHUTD   : 000 Seconds
LOTRANS  : 180.0 Volts
HITRANS  : 266.0 Volts
RETPCT   : 000.0 Percent
ITEMP    : 29.2 C Internal
ALARMDEL : 30 seconds
BATTV    : 13.6 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : None
STATFLAG : 0x07000008 Status Flag
MANDATE  : 2011-10-28
SERIALNO : 4B1144P35645  
BATTDATE : 2011-10-28
NOMOUTV  : 230 Volts
NOMINV   : 230 Volts
NOMBATTV :  12.0 Volts
NOMPOWER : 400 Watts
FIRMWARE : 817.v8.I USB FW:v8
END APC  : 2012-11-10 23:32:03 +0100

Things like this freaks me out, I haven't done anything that I would know. Maybe KDE did someting with X I and it's power managment, I don't know :S

Offline

#3 2012-11-11 04:19:20

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,545

Re: [Solved] APC UPS - systemd daemon not active

I wonder if it's a race condition, where sometimes systemd starts apcupsd before the UPS has been found on the USB bus. I have a very similar UPS here, and I've not seen this problem myself, though.

Offline

#4 2012-11-11 10:26:51

demaio
Member
From: Germany
Registered: 2012-09-02
Posts: 64
Website

Re: [Solved] APC UPS - systemd daemon not active

frojnd wrote:

Things like this freaks me out, I haven't done anything that I would know. Maybe KDE did someting with X I and it's power managment, I don't know :S

I have seen this behavior independent of systemd and Arch (our servers are running Debian/Ubuntu). After starting the APCUPSD service they (the UPSs) just need one or two minutes before the service daemon has all the data for its status output. Trying to get status output before this delay always shows me "connection refused". USB devices seem to be quicker than RS232 devices though...

EDIT:

So just try to wait a few minutes after starting apcupsd, do nothing meanwhile (not starting X etc.), and recheck the status after a while.

deMaio

Last edited by demaio (2012-11-11 10:29:15)

Offline

#5 2012-11-11 15:33:11

frojnd
Member
Registered: 2008-09-20
Posts: 114

Re: [Solved] APC UPS - systemd daemon not active

Tank you both guys for response!

demaio, I've tried your method:

sudo systemctl stop apcupsd.service && sudo systemctl start apcupsd.service

And the service became active immediately, before that I stopped kdm service (no X was running at the time)

Offline

#6 2012-11-11 17:02:48

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,545

Re: [Solved] APC UPS - systemd daemon not active

You might try adding "Restart=on-failure" to this unit file's [Service] section. (Copy the file to /etc/systemd/system/ and edit that copy, so pacman won't overwrite it on upgrades.) This change will make systemd keep trying to start the service until it stops failing. It's a bit of a dirty hack, but better than not having it start by itself, no?

Offline

#7 2012-11-14 19:41:25

frojnd
Member
Registered: 2008-09-20
Posts: 114

Re: [Solved] APC UPS - systemd daemon not active

Thanx ataraxia smile

Offline

Board footer

Powered by FluxBB