SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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.
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
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.
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.
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.
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.
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.
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?
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.
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.
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).
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.