Stuck with fw_nut

New to SGIs? Need help getting things going? This is the forum for you!
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
pub_bronx
Posts: 179
Joined: Fri Jan 13, 2006 10:39 am
Location: Switzerland

Stuck with fw_nut

Unread postby pub_bronx » Sun Feb 18, 2007 1:19 pm

Hello,
These last days, there have been several posts about fw_nut and APC UPS. As I own an APC Back-UPS 500 CS, and as I've had some electrical issues some time ago, I've decided to get my octane shut down by my UPS in case of electrical problem.
As said in a previous post, APC gracefully offers to provide the missing serial cable (DB9 <-> RJ45) to connect the UPS to the serial port of the machine that's to be shut down. A simple mail from the support page suffices !
In previous posts, it has been explained how to configure an enable the serial port to allow communications :
1. in /etc/inittab :

Code: Select all

t2:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd2 co_9600"     # port 2

potentially followed by a

Code: Select all

telinit q
if the line had to be modified;
2. in /etc/uucp/Devices :

Code: Select all

Direct ttyd2 - 9600 direct

3. in /etc/uucp/Systems :

Code: Select all

Direct Any Direct 9600 -
[/code]
At this point, the serial port #2 should be available.
Now let's go on to NUT:
1. configuration of the UPS in /usr/freeware/etc/nut/ups.conf :

Code: Select all

[myups]
driver = genericups
port = /dev/ttyd2

2. configuration of the driver in /usr/freeware/share/nut/drivers :

Code: Select all

./genericups -a myups -x upstype=9

BUT here is the result :

Code: Select all

Network UPS Tools - Generic UPS driver 0.60 (1.2.2)
UPS type: APC Back-UPS (940-0023A cable)
This program is currently running as nobody (UID 60001)
/dev/ttyd2 is owned by user root (UID 0), mode 0666
Change the port name, or fix the permissions or ownership of /dev/ttyd2 and try again.
Unable to open /dev/ttyd2: Error 0

OK, seems easy to solve: the message tells that the program runs as 'nobody', but the serial port (ttyd2) is owned by root. The user 'nobody' must be the one specified as the default one at compile time, by the parameter ./configure --with-user=nobody. This is a known problem, which is discussed is the NUT FAQ: there are two answers to this question. But my problem is :
- I don't understand the first answer;
- the second one doesn't improve the situation in any way.
In the documentation of the NUT version whoses version number is the closest to the one provided in the freeware reposibory, under the point 6, they mention the access right problem. So I've tried to

Code: Select all

chmod 0600 /dev/ttyd2
chown nobody:nobody /dev/ttyd2

It doesn't change anything...
Has anybody ever managed to solve this problem ?
Thanks in advance.
PB
Octane R14k 600MHz, V6, 2048 MB RAM, 73GB HD0, 18GB HD1, 73GB HD2

User avatar
joerg
Donor
Donor
Posts: 2229
Joined: Thu Jan 08, 2004 6:57 am
Location: In an origin rack - Germany
Contact:

Unread postby joerg » Sun Feb 18, 2007 1:37 pm

1. You can recompile the software (dont forget to create a nekoware package than) with the right --with-user=nut option
2. Create a new system account named "nut" and place usr=nut in your config file.


Some time ago i have compiled a open source software for APC devices. But i cant find it anymore. I also never get the software to work with my APC.

regards
Joerg

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Tue Feb 20, 2007 4:29 am

Wow,
Hi pub_bronx !
Relieved to find I'm not the only one having difficulties with nut.
http://forums.nekochan.net/viewtopic.php?t=12911

Your post has helped me to get further.. to the point that I'm stuck where you are :D

Do you know how to recompile fw_nut?
Would a recompile work only on the machine on which it was compiled?

Further input would be much appreciated
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
joerg
Donor
Donor
Posts: 2229
Joined: Thu Jan 08, 2004 6:57 am
Location: In an origin rack - Germany
Contact:

Unread postby joerg » Tue Feb 20, 2007 4:40 am

algoart wrote:Wow,
Hi pub_bronx !
Relieved to find I'm not the only one having difficulties with nut.
http://forums.nekochan.net/viewtopic.php?t=12911

Your post has helped me to get further.. to the point that I'm stuck where you are :D

Do you know how to recompile fw_nut?


Donload the old source tarball and the patch from freeware.sgi.com. Extract it... setup your environment. Try a ./configure --help and select your options and run the configure with it. Gmake und gmake install at the end and thats it.... takes only a few minutes. Current releases dont compile out of the box.

Would a recompile work only on the machine on which it was compiled?

Depends on the flags and how different the machine/OS are. I mean 32 vs 64bit or mips3 vs mips4. You also have to check the dependancies of the software. A quick check says there are no deps. So if you build it as 32bit mips it would run on every sgi machine. If you compiler it as mips4 you need a maschine with r5k cpu or better.

regards
Joerg

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Tue Feb 20, 2007 6:14 am

Whoa!

pub_bronx, I take that back, I'm not as far as you on this:

2. configuration of the driver in /usr/freeware/share/nut/drivers :
Code:
./genericups -a myups -x upstype=9


How or in which file do I configure the apcsmart driver, as /usr/freeware/share/nut//drivers doesn't contain a .conf file?

DOH! missed the "." in

Code: Select all

./genericups -a myups -x upstype=9


Thanks Joerg, I'd like to try that, but might be a bit beyond my knowledge at the moment. :oops:
Last edited by algoart on Wed Feb 21, 2007 2:48 pm, edited 1 time in total.
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
pub_bronx
Posts: 179
Joined: Fri Jan 13, 2006 10:39 am
Location: Switzerland

Unread postby pub_bronx » Tue Feb 20, 2007 6:31 am

algoart wrote:Wow,
Hi pub_bronx !
Relieved to find I'm not the only one having difficulties with nut.
http://forums.nekochan.net/viewtopic.php?t=12911

Your post has helped me to get further.. to the point that I'm stuck where you are :D

Do you know how to recompile fw_nut?
Would a recompile work only on the machine on which it was compiled?

Further input would be much appreciated


Hello algoart,
I've managed to compile the latest version of nut. It needs testing, and if it's OK, I'll package it and propose it to the nekoware repository
PB
Octane R14k 600MHz, V6, 2048 MB RAM, 73GB HD0, 18GB HD1, 73GB HD2

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Tue Feb 20, 2007 6:34 am

Queuing up already :D
Will you post availability on this thread, or could you pm me on progress?

Thanks
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Thu Feb 22, 2007 2:14 am

Some progress, but I think I need some configuration help.
Using fw-nut, did all of the above, then changed permissions on ttyd2 which gave:

Code: Select all

DizietSma 5# /usr/freeware/share/nut/drivers/./genericups -a apcsmart -x upstype=9Network UPS Tools - Generic UPS driver 0.60 (1.2.2)
UPS type: APC Back-UPS (940-0023A cable)


Then :

Code: Select all

DizietSma 6# /etc/init.d/fw_nut start
Starting NUT daemons: drivers server monitor.


This led me to check and alter upsmon.conf, which now gives;

Code: Select all

DizietSma 17# /usr/freeware/sbin/upsmon
Network UPS Tools upsmon 1.2.2
UPS: apcsmart@DizietSma (master) (power value 1)
Using power down flag file /usr/freeware/etc/nut/killpower


It seems that 'killpower" is generated when power failure occurs and is used as a log, not a command.
Is modifying upssched.conf the next step?
Any pointers welcome :D

Thanks
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
o2ric
Posts: 29
Joined: Sat Jan 31, 2004 6:32 am
Location: Madrid, Spain

Unread postby o2ric » Thu Feb 22, 2007 6:41 am

Some time ago I donated to the people building the nekoware packages the build and patch files for all the stuff I used to maintain in the SGI Freeware project. fw_nut was among them, and hopefully there will be a proper neko_nut package (ask them).

Unfortunately, I cannot help on this specific problem, as I haven't anymore a SGI workstation to work with. However, in my mail archives I've found the following message regarding nut, which may help:

From: Mark Collins <xxx@SGI.com>
To: Andrea Suatoni
Subject: RE: NUT, Network UPS Tools, for Irix 6.5.23
Date: Tue, 21 Sep 2004 12:51:59 -0700

Hi Andrea,

Thank you for your reply. I did get fw_nut working! It was a configuration
issue, in one of the nut files.

Now I find that APC is working on a version of their software for IRIX. But,
it is not ready.

Thanks again,
Mark

-----Original Message-----
From: Andrea Suatoni
Sent: Saturday, September 18, 2004 12:26 PM
To: Mark Collins
Subject: Re: NUT, Network UPS Tools, for Irix 6.5.23

Mark Collins wrote:

> Hi Andrea,
>
> I am an SGI Support Engineer in the USA. I am attempting to use nut-1.2.2
> (the freeware version) on an SGI Origin350 with Irix 6.5.23 without
success.
> This is with an APC 3000 XL ups, using the newapc driver. upsmon won't
> connect to the ups, it seems to be unable to login to the ups. Does this
> sound like a configuration issue?

Hi Mark!

I'm so sorry to answer with a month of delay, but I was out on vacation, and

on my return there were thousands of messages to be read.

Your problem doesn't sound too familiar to me. Unfortunately, I tested
fw_nut only with the Victron driver, which is the only UPS unit I had at
that time. I should check the NUT files on my O2 (currently shutted down) to

verify if there are quirks in the NUT configuration (I don't recall any,
tho).

Maybe my question is superfluos, but I assume that you have disables any
other IRIX process on the serial port you are using with your UPS, and that
you have already checked that the UPS is operating properly using other UPS
software (with a PC, for example).

> Have you attempted to compile any of the later releases of NUT for Irix?

To be honest, no. The SGI freeware project has had a stop for almost an
year, and after a restart last May, it seems that it is again in sleep mode.

I'll have to send a wake up ping to the current maintainer, and see if there

are any news. Until then, I don't know when I'll compile the new version
(it's planned, tho).

Feel free to drop me a mail if you need more assistance: I cannot promise
anything, but I'll see if I can help. Otherwise, try to get in contact with
the NUT maintainers: they used to answer to e-mails.


Andrea

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Thu Feb 22, 2007 10:27 am

Hi Andrea,

Pleasure to hear from you on Neko :D

As far as I see, the daemons seem to be working, as is upsmon.
but I think my problem lies in configuring upssched.conf correctly.
I'll have to look at how to set up timers and PIPEFN.
Don't know how, but I hope to find out.

Alistair
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
pub_bronx
Posts: 179
Joined: Fri Jan 13, 2006 10:39 am
Location: Switzerland

Unread postby pub_bronx » Sun Feb 25, 2007 4:35 am

Hello algoart,
With my nut-2.0.5 compiled version, I didn't go much farer than you. This

Code: Select all

This program is currently running as nobody (UID 60001)
/dev/ttyd2 is owned by user nut (UID 52184), mode 0600
Change the port name, or fix the permissions or ownership of /dev/ttyd2 and try again.
must be an IRIX proper problem.

Anyway, here is the patch I had included the tardist I wanted to upload :

Code: Select all

diff -Naur nut-2.0.5/drivers/al175.c nut-2.0.5-PATCHED/drivers/al175.c
--- nut-2.0.5/drivers/al175.c   Wed Nov 08 03:08:45 CET 2006
+++ nut-2.0.5-PATCHED/drivers/al175.c   Mon Feb 19 23:17:42 CET 2007
@@ -21,6 +21,7 @@
  */


+#include <alloca.h>
 #include <stddef.h>
 #include <ctype.h>
 #include <stdlib.h>
@@ -39,12 +40,13 @@

 typedef    unsigned char   byte_t;

-#if DEBUG
+#if DEBUG && !defined(__sgi)
 #define XTRACE(fmt, ...) do {                  \
    upsdebugx(1, "%s: " fmt, __FUNCTION__ __VA_ARGS__); \
 } while (0)
 #else
-#define XTRACE(fmt, ...) do {} while (0)
+//#define XTRACE(fmt, ...) do {} while (0)
+#define XTRACE(fmt) do {} while (0)
 #endif

 /************
@@ -83,19 +85,33 @@
  * @param  size the size in bytes
  * @return alloca'ed memory as raw_data
  */
-#define raw_alloca(size)       \
-({                 \
-   raw_data_t data;        \
-                   \
-   data.buf       = alloca(size);  \
-   data.buf_size  = size;      \
-                   \
-   data.begin     = data.buf;  \
-   data.end       = data.buf;  \                             
-                   \
-   data;               \
-})
+//#define raw_alloca(size)     \
+//({                   \
+// raw_data_t data;        \
+//                 \
+// data.buf       = alloca(size);  \
+// data.buf_size  = size;      \
+//                 \
+// data.begin     = data.buf;  \
+// data.end       = data.buf;  \
+//                 \
+// data;               \
+//})

+raw_data_t raw_alloca(size)
+{
+   raw_data_t data;
+                                                             
+   data.buf       = alloca(size);                           
+   data.buf_size  = size;                                   
+                                                             
+   data.begin     = data.buf;                               
+   data.end       = data.buf;                               
+                                                             
+   return data;                                             
+}                                                           
+                                                             
+                                                             
 /**                                                         
  * xmalloc raw buffer                                       
  * @param  size    the size in bytes                         
@@ -424,7 +440,8 @@                                           
        },                                                   
    };                                                       
                                                             
-   return comli_prepare(dest, &h, NULL, 0);
+// return comli_prepare(dest, &h, NULL, 0);
+   comli_prepare(dest, &h, NULL, 0);
 }


@@ -460,7 +477,8 @@

    snprintf(data+2, 6+1, "%2X%2X%2X", pr1, pr2, pr3);

-   return comli_prepare(dest, &h, data, 8);
+// return comli_prepare(dest, &h, data, 8);
+   comli_prepare(dest, &h, data, 8);
 }

 /***********************
diff -Naur nut-2.0.5/include/common.h nut-2.0.5-PATCHED/include/common.h
--- nut-2.0.5/include/common.h  Thu Jan 04 21:19:27 CET 2007
+++ nut-2.0.5-PATCHED/include/common.h  Mon Feb 19 21:36:34 CET 2007
@@ -87,20 +87,20 @@
 /* Return the alternate path for pid files */
 const char * altpidpath(void);

-void upslog_with_errno(int priority, const char *fmt, ...)
-   __attribute__ ((__format__ (__printf__, 2, 3)));
-void upslogx(int priority, const char *fmt, ...)
-   __attribute__ ((__format__ (__printf__, 2, 3)));
-void upsdebug_with_errno(int level, const char *fmt, ...)
-   __attribute__ ((__format__ (__printf__, 2, 3)));
-void upsdebugx(int level, const char *fmt, ...)
-   __attribute__ ((__format__ (__printf__, 2, 3)));
+void upslog_with_errno(int priority, const char *fmt, ...);
+// __attribute__ ((__format__ (__printf__, 2, 3)));
+void upslogx(int priority, const char *fmt, ...);
+// __attribute__ ((__format__ (__printf__, 2, 3)));
+void upsdebug_with_errno(int level, const char *fmt, ...);
+// __attribute__ ((__format__ (__printf__, 2, 3)));
+void upsdebugx(int level, const char *fmt, ...);
+// __attribute__ ((__format__ (__printf__, 2, 3)));
 void upsdebug_hex(int level, const char *msg, const unsigned char *buf, int len);
                                                             
-void fatal_with_errno(const char *fmt, ...)                 
-   __attribute__ ((__format__ (__printf__, 1, 2))) __attribute((noreturn));
-void fatalx(const char *fmt, ...)                           
-   __attribute__ ((__format__ (__printf__, 1, 2))) __attribute((noreturn));
+void fatal_with_errno(const char *fmt, ...);                 
+// __attribute__ ((__format__ (__printf__, 1, 2))) __attribute((noreturn));
+void fatalx(const char *fmt, ...);
+// __attribute__ ((__format__ (__printf__, 1, 2))) __attribute((noreturn));

 extern int nut_debug_level;



Meanwhile, as I own an APC UPS (so you do IIRC), I switched to building apcupsd. But once again, it compiles fine, but I get thread problem at the execution. But one positive point is that the test phase runs correctly, which proves that the ttyd[12] problem and the cable problem or potentially solved. As soon as I manage to get it working (hopefully), I'll of course upload the tardist into the Nekochan repository!

HTH,
PB
Octane R14k 600MHz, V6, 2048 MB RAM, 73GB HD0, 18GB HD1, 73GB HD2

User avatar
pub_bronx
Posts: 179
Joined: Fri Jan 13, 2006 10:39 am
Location: Switzerland

Unread postby pub_bronx » Sun Feb 25, 2007 4:51 am

Hello algoart,
algoart wrote:Some progress, but I think I need some configuration help.
Using fw-nut, did all of the above, then changed permissions on ttyd2 which gave:

Code: Select all

DizietSma 5# /usr/freeware/share/nut/drivers/./genericups -a apcsmart -x upstype=9Network UPS Tools - Generic UPS driver 0.60 (1.2.2)
UPS type: APC Back-UPS (940-0023A cable)

Could you tell me the steps (chmod/chown on /dev/ttyd2, user/group creation) you ran across to change these permissions and so have an allowed access on ttyd2? I must have been missing something...
Thanks in advance,
PB
Octane R14k 600MHz, V6, 2048 MB RAM, 73GB HD0, 18GB HD1, 73GB HD2

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Sun Feb 25, 2007 4:59 am

Thanks for keeping this alive!
I've been editing fw_nut conf files in every permutation and chown'ing ttyd2 any which way for days,,,, zero
Tried compiling 2.0.5 from source :
with

Code: Select all

./configure --with-user=nut


output:

Code: Select all

gcc: installation problem, cannot exec `as': No such file or directory
configure:2330: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2368: error: C compiler cannot create executables
See `config.log' for more details.

got totally frustrated and uninstalled!
Rebooted and winterm showed;

Code: Select all

DizietSma 1% UX:wall: INFO: Broadcast Message from nut (???) on DizietSma Sun Feb 25 12:32:31 2007

UPS apcsmart@DizietSma is unavailable


Leaves me baffled!
As you can see I seem to have hit an infinity loop :oops:
Any further help much appreciated
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
algoart
Posts: 122
Joined: Sun Oct 08, 2006 11:16 am
Location: Kent, England
Contact:

Unread postby algoart » Sun Feb 25, 2007 5:09 am

I set up a user 'nut', as this seems to be set as default during compile, and NO settings in the conf files want to change it.

Code: Select all

chown nut /dev/ttyd2
chmod 0600 /dev/ttyd2

gave me access to the port, but got a message like "port timed out"!
Octane2/400/V10 - 4 Octane 300/SE - Indigo2 - Indy
Quicksilver - Linux/Win box.

http://www.true2art.com

User avatar
joerg
Donor
Donor
Posts: 2229
Joined: Thu Jan 08, 2004 6:57 am
Location: In an origin rack - Germany
Contact:

Unread postby joerg » Sun Feb 25, 2007 5:16 am

algoart wrote:Rebooted and winterm showed;

Code: Select all

DizietSma 1% UX:wall: INFO: Broadcast Message from nut (???) on DizietSma Sun Feb 25 12:32:31 2007

UPS apcsmart@DizietSma is unavailable


Leaves me baffled!
As you can see I seem to have hit an infinity loop :oops:
Any further help much appreciated


I expect that you have a fw_nut init script which is startet during boot because you have enabled it with chkconfig?

About your gcc error.... as general you have to install your IDO to get gcc working.

regards
Joerg


Return to “Getting Started, Documentation, Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest