LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-23-2006, 09:55 AM   #16
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422

The good news? I got apcupsd working again. The bad news? I have no stinkin idea what I changed to do it.

I decided as long as I was having trouble, I'd upgrade to the latest apcupsd (3.13.11) and compile it. Here is the configure line:

Code:
./configure --prefix=/usr --sbindir=/sbin --enable-usb \
                 --enable-cgi --with-cgi-bin=/home/httpd/cgi-bin \
                 --enable-pthreads
Actually my cgi-bin is in a different place, but that shouldn't affect things. I ran make and checkinstall to make the package and installed it. I also updated my udev rule for the UPS to this:

Code:
BUS=="usb", SYSFS{serial}=="123456", KERNEL=="hiddev*[0-9], NAME="usb/ups0", GROUP="users"
Here are the highlights from /etc/apcupsd.conf:

Code:
UPSCABLE usb
UPSTYPE
DEVICE /dev/usb/ups0
The UPSTYPE is blank as suggested by the config file. Pretty much everything else in the config file is using the defaults.

What is odd, is that I had to reboot the machine to get apcupsd to work. If I unplugged the UPS, restarted udev then plugged the UPS back in and restarted apcupsd, no go. But once I rebooted the whole thing, apcupsd is working like a charm.
 
Old 12-31-2006, 09:52 AM   #17
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Thanks for posting your highlights from apcupsd.conf. Mine is different, see below.

Code:
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0
The UPSTYPE is correct in that it is an apc ups. But the connection is usb, not ttyS0, and not sure why UPSCABLE is saying smart.

Also looking at /var/log/apcupsd.events, here is the following ouptput:

Code:
PANIC! Cannot communicate with UPS via serial port.
Please make sure the port specified on the DEVICE directive is correct,
and that your cable specification on the UPSCABLE directive is correct.
Mon Dec 11 19:19:43 CST 2006  apcupsd error shutdown completed
Also as an FYI, I've had problems with my USB ports in the past

http://www.linuxquestions.org/questi...d.php?t=476779

Last edited by JockVSJock; 12-31-2006 at 09:54 AM.
 
Old 12-31-2006, 02:37 PM   #18
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
My understanding (and I may be wrong) is that the smart entry in UPSCABLE means that you are using a serial connection to communicate with the UPS. If you are using a usb cable (my UPS came with one) I'd seriously suggest changing smart to usb. Hey, at this point, it can't hurt.

I also think that by using apcsmart in the UPSTYPE field, you're again pointing towards using a serial cable rather than a usb cable. If you read the descriptions of the allowed entries for UPSTYPE, leaving it blank forces an autodetection for a usb device, which is probably a good idea. I think the errors you posted are showing that apcupsd is definitely looking for a serial connection, not a usb connection, so you are going to need to edit your apcupsd.conf.

Also, the reason I did the udev rule to create ups0 is that it avoids all that nonsense about hiddev. You might try that as well. I think you're very close so try editing the apcupsd.conf file a bit and see if that doesn't do the trick.
 
Old 01-02-2007, 10:53 AM   #19
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
I went ahead and rebooted the computer, after making the recommended changes.

I don't see any new messages in /var/log/apcupsd.events showing there is a problem.

How do I know that the ups is communicating correctly?
 
Old 01-02-2007, 12:17 PM   #20
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
I guess check the output of /etc/rc.d/rc.apcupsd status and see if everything looks kosher. If the STATUS line is ONLINE, I'd assume there was communication. Of course you could also unplug the UPS and see if apcupsd reacts.
 
Old 01-03-2007, 09:25 AM   #21
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Typing in ps fax | grep apcupsd, returned nothing.

If I do the following command:

Code:
root@ladytron:/etc/apcupsd# apcaccess status
Then this is my output

Code:
FATAL ERROR in apcaccess.c at line 252
tcp_open: cannot connect to server localhost on port 3551.
ERR=Connection refused
If I check out line 252 of apcupsd.conf, it refers to the following:

Code:
250 # Time interval in seconds between writing the DATA records to
251 #   the log file. 0 disables.
252 DATATIME 0
I also referenced the following website for troubleshooting:

http://www.apcupsd.com/manual/Testing_Apcupsd.html

It advised to add NISPORT 3551 where NETSERVER is set to on...


Code:
# NETSERVER [ on | off ] on enables, off disables the network
#  information server. If netstatus is on, a network information
#  server process will be started for serving the STATUS and
#  EVENT data over the network (used by CGI programs).
NETSERVER on
NISPORT 3551
# 1/3/2007, added NISPORT 3551


# NISIP <dotted notation ip address>
#  IP address on which NIS server will listen for incoming connections.
#  Default value is 0.0.0.0 that means any incoming request will be
#  serviced but if you want it to listen to a single subnet you can
#  set it up to that subnet address, for example 192.168.10.0
#  Additionally you can listen for a single IP like 192.168.10.1
NISIP 0.0.0.0

# NISPORT <port> default is 3551 as registered with the IANA
#  port to use for sending STATUS and EVENTS data over the network.
#  It is not used unless NETSERVER is on. If you change this port,
#  you will need to change the corresponding value in the cgi directory
#  and rebuild the cgi programs.
NISPORT 3551

But if you look further down, the NISPORT is already set to 3551, so I'm stuck right now as to where to go next.

thanks
 
Old 01-03-2007, 11:30 AM   #22
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Typing in ps fax | grep apcupsd, returned nothing.
OK, that certainly means that apcupsd is not starting and if it isn't running, then there is nothing listening on port 3551. If you have started it, and it has bombed out, I would think there would be something in the log file. Try starting it from a console and see if it appears in ps. If not, it should leave some clues either in the log file or in the console output.

Quote:
If I check out line 252 of apcupsd.conf, it refers to the following:
Unfortunately, apcupsd.conf isn't the file in the error message, so line 252 of apcupsd.conf is pretty meaningless. I wouldn't worry about this until apcupsd is up and running and you can see it in the output of ps.
 
Old 01-03-2007, 08:05 PM   #23
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
Just to make sure...did you run the 'make-hiddev' script as root in the examples directory that came with the source code after you got it all built and installed?

For me the file was in: /root/apcupsd-3.10.18/examples

I got that port 3551 error before I ran that script, after I did that things started working for me.
 
Old 01-06-2007, 08:17 PM   #24
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by buaku
Just to make sure...did you run the 'make-hiddev' script as root in the examples directory that came with the source code after you got it all built and installed?

For me the file was in: /root/apcupsd-3.10.18/examples

I got that port 3551 error before I ran that script, after I did that things started working for me.
I can't remember if I ran the 'make-hiddev' or not, so I reran it.

Then I ran apctest to see what is up...

Code:
root@ladytron:/sbin# ./apctest


2007-01-06 20:13:05 apctest 3.12.4 (19 August 2006) slackware
Checking configuration ...

Apcupsd driver usb not found.
The available apcupsd drivers are:
dumb
apcsmart

Most likely, you need to add --enable-usb to your ./configure options.

apctest FATAL ERROR in apctest.c at line 278
Apcupsd cannot continue without a valid driver.
apctest FATAL ERROR in apctest.c at line 278
Apcupsd cannot continue without a valid driver.
apctest error termination completed
Is there anyway I rerun the config and include usb?

thanks
 
Old 01-07-2007, 07:26 AM   #25
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Well, certainly re-run ./configure with the --enable-usb (and any other relevant options) and then run make and make install. If you check out a few posts ago, I've got the ./configure options I ran that work on my righ. It might just add the USB bits, or it might re-do the whole thing. At any rate, you need to go through the compile process again if you want USB support. No other way to do it.
 
Old 01-07-2007, 11:25 AM   #26
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
I reran everything with --configure with usb, ran make and make install.

Apcupsd now runs

Code:
root@ladytron:/sbin# ps aux | grep apcupsd
root     12548  0.0  0.1   3932   768 ?        Ss   11:15   0:00 ./apcupsd
root     12551  0.0  0.1   3932   768 ?        S    11:15   0:00 ./apcupsd
root     12552  0.0  0.1   3932   768 ?        S    11:15   0:00 ./apcupsd

Here is the output for apcaccess

Code:
root@ladytron:/sbin# ./apcaccess
APC      : 001,034,0849
DATE     : Sun Jan 07 11:16:57 CST 2007
HOSTNAME : ladytron
RELEASE  : 3.12.4
VERSION  : 3.12.4 (19 August 2006) slackware
UPSNAME  : ladytron
CABLE    : USB Cable
MODEL    : Back-UPS ES 350
UPSMODE  : Stand Alone
STARTTIME: Sun Jan 07 11:15:44 CST 2007
STATUS   : ONLINE
LINEV    : 119.0 Volts
LOADPCT  :   8.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  43.5 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
LOTRANS  : 088.0 Volts
HITRANS  : 138.0 Volts
ALARMDEL : Always
BATTV    : 13.5 Volts
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
STATFLAG : 0x07000008 Status Flag
MANDATE  : 2004-11-13
SERIALNO : AB0446249686
BATTDATE : 2000-00-00
NOMBATTV :  12.0
FIRMWARE : 00.e5.D USB FW:e5
APCMODEL : Back-UPS ES 350
END APC  : Sun Jan 07 11:17:53 CST 2007
If I run apctest, is there anything I can do to test and make sure if the power goes out, that the apc will do its job?

Code:
root@ladytron:/sbin# ./apctest


2007-01-07 11:22:53 apctest 3.12.4 (19 August 2006) slackware
Checking configuration ...
Attached to driver: usb
sharenet.type = DISABLE
cable.type = USB_CABLE

You are using a USB cable type, so I'm entering USB test mode
mode.type = USB_UPS
Setting up the port ...
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) Change battery date
5) View battery date
6) View manufacturing date
7) Set alarm behavior
8) Quit

Select function number:
props to Hangdog42 for all of his help

Last edited by JockVSJock; 01-07-2007 at 11:27 AM.
 
Old 01-07-2007, 05:44 PM   #27
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Congrats on sticking with it!!!!!!

To be honest, the absolute best way to test that the apc is doing its job is to arrange for a localized power outage (also known as yanking the apc plug out of the wall).
 
Old 01-07-2007, 08:12 PM   #28
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Thanks for the help...BUT, when I pulled the ac outlet out of the wall, the UPS DID NOT take over.

I was shocked...

I went thru the /var/log/apcupsd.events log to see what is up, if anything...

Code:
Sun Jan 07 08:09:01 CST 2007  apcupsd 3.12.4 (19 August 2006) slackware startup succeeded
Sun Jan 07 11:13:50 CST 2007  apcupsd exiting, signal 15
Sun Jan 07 11:13:50 CST 2007  apcupsd shutdown succeeded
Sun Jan 07 11:15:56 CST 2007  apcupsd 3.12.4 (19 August 2006) slackware startup succeeded
Sun Jan 07 11:20:13 CST 2007  apcupsd exiting, signal 15
Sun Jan 07 11:20:13 CST 2007  apcupsd shutdown succeeded
Sun Jan 07 11:48:59 CST 2007  apcupsd 3.12.4 (19 August 2006) slackware startup succeeded
Sun Jan 07 19:53:32 CST 2007  apcupsd 3.12.4 (19 August 2006) slackware startup succeeded
Sun Jan 07 19:53:42 CST 2007  Valid lock file for pid=3632, but not ours pid=3637
Sun Jan 07 19:53:42 CST 2007  apcupsd FATAL ERROR in device.c at line 68
Unable to create UPS lock file.
Sun Jan 07 19:53:42 CST 2007  Valid lock file for pid=3632, but not ours pid=3637
Sun Jan 07 19:53:42 CST 2007  apcupsd error shutdown completed
Looks like there is a conflict on the pid?!!?

Not sure what this means?
 
Old 01-08-2007, 06:51 AM   #29
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Looks like there is a conflict on the pid?!!?
Hm. I wonder if your ps aux output is a clue:

Quote:
root@ladytron:/sbin# ps aux | grep apcupsd
root 12548 0.0 0.1 3932 768 ? Ss 11:15 0:00 ./apcupsd
root 12551 0.0 0.1 3932 768 ? S 11:15 0:00 ./apcupsd
root 12552 0.0 0.1 3932 768 ? S 11:15 0:00 ./apcupsd
I think you should have only one apcupsd process running and it looks as if you have three. You might want to go through your startup scripts and see if there is more than one place it is started. Otherwise, try killing all three, then start one and see if the plug pulling works.
 
Old 01-08-2007, 11:59 AM   #30
MQMan
Member
 
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 581

Rep: Reputation: 38
You didn't indicate at what time you pulled the plug, so it's difficult to tell if the failure to start apcupsd was before the test, in which case it obviously wouldn't work, or if that was the restart after the failed test.

I think you will see multiple copies of apcupsd unless you use this:
Code:
--enable-pthreads
This option enables pthreads support causing apcupsd to be built as a threaded program rather than forking to create separate processes. apcupsd built in this fashion is more efficient that the standard version being one third the data size and less overhead locking and coping shared memory. This option is highly recommended for Windows builds.
Try manually clearing the locks before starting apcupsd: /var/lock/subsys/apcupcsd and /var/run/apcupsd.pid.

Cheers.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot run apcupsd on slackware 10.2 sugar2 Slackware 7 05-15-2006 04:16 PM
apcupsd - apctest eyt Linux - Hardware 10 03-09-2006 01:16 PM
apcupsd gui? PowerMatt Linux - Software 1 09-06-2004 06:14 PM
I have a problema using APCUPSD Dapernia Linux - Hardware 0 07-21-2003 04:46 PM
gui for apcupsd tatwell Linux - Software 2 07-14-2003 02:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration