LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 01-29-2014, 07:46 PM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Rep: Reputation: 30
Smile APC Smart-UPS Serial connection problems


Hi all,
I have an old Ubuntu server (uname -r: 2.6.17-10-generic). We've been having issues with coming in in the morning and the thing has restarted or is off, so we have no Internet and had to restart it. I figured the APC BACK-UPS wasn't doing its job so last month we bought a shiny new Smart-UPS. But I can't get them to talk to each other.

The UPS came with a serial cable labelled "940-0625A" which I have plugged in to a serial port on the server.

My apcupsd.conf is as follows:
Code:
UPSNAME smartups
UPSCABLE smart (note that putting in the actual cable number doesn't work - unrecognized cable)
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (this is just a guess, I've tried S1 as well)
LOCKFILE /var/lock
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NISIP 127.0.0.1
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
But there is a problem because when I run apcupsd I get a fatal error:
Code:
Wed Jan 29 20:06:47 EST 2014  apcupsd FATAL ERROR in smartsetup.c at line 174
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.
Wed Jan 29 20:06:47 EST 2014  apcupsd error shutdown completed
I've installed setserial which just seems to report that my serial ports do in fact exist. Example:
Code:
/etc/apcupsd# setserial /dev/ttyS1
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
Not sure where else to go from here... Anyone know how to resolve this? Thanks!
 
Old 01-29-2014, 10:55 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
Post the model number for your smart UPS.
 
Old 01-30-2014, 04:39 PM   #3
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
It is a Smart-UPS 1500VA (SMT1500) like this one: http://www.newegg.ca/Product/Product...140130223804:s
 
Old 01-30-2014, 05:09 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
I am unfamiliar with the SMT models but check out acpuspd's website. They are unsupported because APC will not release information about their new protocol.

http://www.apcupsd.org/

I will say that APC does provide a linux version of their powerchute software but I never tried using it. They support RHEL and SuSE distributions.

Last edited by michaelk; 01-30-2014 at 05:16 PM.
 
Old 02-04-2014, 07:02 PM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
Yes, I've read the apcupsd manual (http://www.apcupsd.com/manual/#configuration-examples) and googled extensively, but I can't seem to get the apcupsd to recognise my cable. I was hoping someone else had experienced the issue and managed to solve it, or at least understood the inner workings of the apcupsd program better than I and would know what options I could try to get it working.

ETA: I don't even know how to tell WHICH serial port the apcupsd thinks the UPS is plugged into, since using either /dev/ttyS0 and /dev/ttyS1 (and setserial output) produce identical results. When I try to communicate with either port using Minicom, nothing happens.

Last edited by Avatar; 02-04-2014 at 07:29 PM.
 
Old 02-04-2014, 09:05 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
apcupsd updated their home page and removed the note about the SMT UPS models. It basically said these devices are unsupported as is due to APC's new microlink communication protocol. That said you can either use the simple cable with reduced capability as described in the manual or install the AP9620 card.

FYI:
http://apcupsd-ups-control-software....rd-td6953.html
 
Old 02-06-2014, 08:02 AM   #7
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
Hi Michael,

You're correct; it turns out my model of new APC UPS does in fact use a Microlink protocol, which my old server and old apcupsd cannot communicate. Mystery solved as to WHY I can't get them to talk, now the question as to how I can fix it.

This very interesting thread: http://forums.apc.com/thread/5374 indicates that after 3 years APC agreed it was unwise to alienate all its non-Microsoft users, and created a second protocol (MODBUS) which they shared with apcupsd developers. Apparently there is a new version of apcupsd that uses the new protocol. This is likely why the notice came off their homepage?

Is there a way to tell if my UPS supports MODBUS and how I can get the new apcupsd installed on my old Linux (might not be compatible?)
 
Old 02-06-2014, 08:57 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
I do not know how to tell if your UPS supports MODBUS. I suppose you need to contact APC and ask. Be sure to note its current firmware version.

You will want to download the latest version and follow the manual on how to install from source files.
 
Old 04-01-2014, 06:43 PM   #9
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
Question

OK... I've compiled the newest apcupsd from source. This incorporates the modbus protocol and it had the correct cable listed, which I've used. It seems to have installed successfully, however I still cannot connect to my APC UPS over serial. When I type "apcaccess status" I do see the stats from the UPS and the STATUS: COMMLOST, STATFLAG: 0x05000100.

new apcupsd.config is as follows:
Code:
UPSNAME APCUPS
UPSCABLE 940-0625A
UPSTYPE modbus
DEVICE /dev/ttyS1
LOCKFILE /var/lock
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
I checked in /var/log/apcupsd.events and saw the following:
"Communications with UPS lost" (repeated about every 4-6 minutes)
"apcserver: cannot bind port 3551. ERR=Address already in use" (every hour. I used netstat to verify that nothing is using 3551)

Again, I'm not sure how to tell which serial port it even thinks it's connected to. When I run apcupsd, nothing happens, but it doesn't seem to actually run either. Thanks for any help.

Last edited by Avatar; 04-01-2014 at 07:04 PM. Reason: added info
 
Old 04-01-2014, 07:14 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
Typically when a daemon starts successfully from the command line there isn't any "feedback" and all you get is the next prompt.

You can verify that it is running via
ps ax | grep apcupsd

If the apcupsd daemon was not running you would not be able to see the stats from the UPS.
i.e.
Code:
apcaccess
Error contacting apcupsd @ localhost:3551: Connection refused
Also take a look at the log file /var/log/apcupsd.events.

So post the stats.
 
Old 04-01-2014, 07:48 PM   #11
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
Sorry - I edited my previous post to include the information from apcupsd.events, but now that I refresh the page, the edits are gone!

Anyway - I do in fact see apcupsd running in ps. I restarted it a few times for good measure.

/var/log/apcupsd.events reports
"Communications with UPS lost." (every few minutes)
"apcserver: Cannot bind port 3551. ERR=Address already in use" (once an hour. I verified with netstat that nothing is running on 3551).

I have physically gone into the server room and plugged the UPS into the other serial port on the server - didn't help
 
Old 04-01-2014, 08:20 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,476

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
According to the documentation the required settings for modbus are:
Quote:
UPSCABLE smart
UPSTYPE modbus
DEVICE /dev/ttyS1
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable
I changed the above to match your serial port setting...

http://www.apcupsd.org/manual/manual.html#modbus-driver
 
Old 04-03-2014, 09:08 AM   #13
sniff
Member
 
Registered: Jan 2003
Location: Durham UK
Distribution: openSUSE 12.2/3 x86_64, Debian
Posts: 313

Rep: Reputation: 42
Hello Avatar,

I have a APC Smart-UPS 1000 attached via USB. Is that a possible config option for you?

Cheers,
Phil
 
Old 06-17-2014, 07:23 PM   #14
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Original Poster
Rep: Reputation: 30
Hi sniff,

Sadly, no. This server is .. ahem.. quirky. If something is plugged into a USB port I am not guaranteed that it will boot up successfully after a power outage. (Backups are done over the network now...) My last few (pre-MODBUS) APC UPSes all connected via serial cable and when I bought this one I made sure it had serial too.

Now, if you could get your Smart-UPS connected via serial, I would be very interested in how you did it

Michaelk, yep, I have tried those settings from the manual. I thought it would work better with my actual cable listed but alas, nothing seems to work. As of today I still get "Communications with UPS lost" every 10 minutes in my apcupsd.events file.
 
  


Reply

Tags
apc, serial, ups


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
APC Smart-UPS and apcupsd michaelsr Linux - Software 4 06-24-2014 06:49 AM
APC UPS backup-ups ES RJ-45 augurseer Linux - Hardware 3 11-18-2009 11:32 PM
APC Smart Ups & Ubuntu 5.10 renaissance Ubuntu 1 04-29-2006 03:46 AM
APC UPS BX1000: USB connection in Fedora RottenMutt Linux - Hardware 8 05-06-2005 12:44 PM
apc Back-ups a10392 Debian 1 12-03-2004 10:24 AM


All times are GMT -5. The time now is 01:23 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration