tehnic at occidentalconsulting.com
2007-May-28 09:53 UTC
[Nut-upsuser] Problems starting upsd
Hello list, I'm fresh in using an ups for shutting down a linux server and i was thinking someone could give a hand at debugging a problem i stumbled to. I'm used to the redhat type of distribution, mainly centos 4/5, and off-course i installed nut and nut-client from the available rpm packages. After some reading i disconnected the server from the power supplied by the ups and proceeded in setting it up in the configuration files after i plugged the server directly to the outlet. The ups is a unknown brand and after some googling i've found out that it uses the fenton driver. I saw the warning that says the fenton driver will be removed and the megatec one replaces it so i tried with the megatec driver instead. All configuration went smooth and the megatec driver recognized the ups and all was working fine. So i reconnected the server to the ups. And at start-up i started to receive some weird messages that warned me the connection to the ups was lost. The ups is connected to the server through a serial cable on ttyS1. Here's what's happening when i try to start the ups daemon: [root at corporate log]# [root at corporate all]# service ups start Starting megatec: Network UPS Tools - Megatec protocol driver 1.5 (2.0.5) Carlos Rodrigues (c) 2003-2006 Megatec protocol UPS detected [ Pro 1400 4.01p]. [ OK ] Starting upsd: Network UPS Tools upsd 2.0.5 Can't connect to UPS [upguards] (upguards): No such file or directory [ OK ] Starting UPS monitor (master): Network UPS Tools upsmon 2.0.5 UPS: upguards at localhost (master) (power value 1) Using power down flag file /etc/killpower [ OK ] [root at corporate all]# Broadcast message from nut (Mon May 28 12:41:24 2007): Communications with UPS upguards at localhost lost Broadcast message from nut (Mon May 28 12:41:29 2007): UPS upguards at localhost is unavailable [root at corporate all]# The ups.conf file contains only these lines: [upguards] driver = megatec port = /dev/ttyS1 desc = "UPguardS Pro 1400" The funny thing is that when the power to the server was not supplied by the ups all worked fine but when i go through the ups the daemon fails. I've checked permissions, and i have the user nut that is in the group uucp and that group can read and write to ttyS1 I cannot seem to find who is causing the No such file or directory error message when the daemon starts up. Another weird thing is if i start the driver manually and then the daemon all is fine and working ! Here's what i'm talking about: [root at corporate ups]# upsdrvctl start upguards Network UPS Tools - UPS driver controller 2.0.5 Network UPS Tools - Megatec protocol driver 1.5 (2.0.5) Carlos Rodrigues (c) 2003-2006 Megatec protocol UPS detected [ Pro 1400 4.01p]. [root at corporate ups]# upsc upguards at localhost Error: Connection failure: Connection refused [root at corporate ups]# service ups start Starting megatec: Network UPS Tools - Megatec protocol driver 1.5 (2.0.5) Carlos Rodrigues (c) 2003-2006 /dev/ttyS1 is locked by another process [FAILED] Starting upsd: Network UPS Tools upsd 2.0.5 Connected to UPS [upguards]: upguards [ OK ] Starting UPS monitor (master): Network UPS Tools upsmon 2.0.5 UPS: upguards at localhost (master) (power value 1) Using power down flag file /etc/killpower [ OK ] [root at corporate ups]# upsc upguards at localhost battery.charge: 85.0 battery.voltage: 26.20 battery.voltage.nominal: 24.0 driver.name: megatec driver.parameter.port: /dev/ttyS1 driver.version: 2.0.5 driver.version.internal: 1.5 input.frequency: 49.0 input.voltage: 208.0 input.voltage.fault: 208.0 input.voltage.maximum: 212.0 input.voltage.minimum: 208.0 output.voltage: 208.0 output.voltage.nominal: 220.0 ups.beeper.status: enabled ups.delay.shutdown: 0 ups.delay.start: 2 ups.load: 3.0 ups.mfr: ups.model: Pro 1400 4.01p ups.serial: unknown ups.status: OL ups.temperature: 43.0 [root at corporate ups]# I'm VERY confused right now.
> Here's what's happening when i try to start the ups daemon: > > [root at corporate log]# [root at corporate all]# service ups start > Starting megatec: Network UPS Tools - Megatec protocol driver 1.5 (2.0.5) > Carlos Rodrigues (c) 2003-2006 > > Megatec protocol UPS detected [ Pro 1400 4.01p]. > [ OK ] > Starting upsd: Network UPS Tools upsd 2.0.5 > Can't connect to UPS [upguards] (upguards): No such file or directory > [ OK ]The startup script is probably not using 'upsdrvctl' to start the driver, but starts the driver directly. This is wrong. Talk to whoever wrote this script, we didn't.> Starting UPS monitor (master): Network UPS Tools upsmon 2.0.5 > UPS: upguards at localhost (master) (power value 1) > Using power down flag file /etc/killpower > > [ OK ] > [root at corporate all]# > Broadcast message from nut (Mon May 28 12:41:24 2007): > > Communications with UPS upguards at localhost lost > > Broadcast message from nut (Mon May 28 12:41:29 2007): > > UPS upguards at localhost is unavailableSure, the socket the driver uses has a different name than the server expects.> The ups.conf file contains only these lines: > > [upguards] > driver = megatec > port = /dev/ttyS1 > desc = "UPguardS Pro 1400"Your 'ups.conf' file is fine.> The funny thing is that when the power to the server was not supplied by > the ups all worked fine but when i go through the ups the daemon fails.This is not related.> I've checked permissions, and i have the user nut that is in the group > uucp and that group can read and write to ttyS1 > > I cannot seem to find who is causing the No such file or directory error > message when the daemon starts up. > > Another weird thing is if i start the driver manually and then the daemon > all is fine and working !This is indicative for problems in the startup script. Best regards, Arjen -- Eindhoven - The Netherlands Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57
>> >>> Here's what's happening when i try to start the ups daemon: >>> >>> [root at corporate log]# [root at corporate all]# service ups start >>> Starting megatec: Network UPS Tools - Megatec protocol driver 1.5 >>> (2.0.5) >>> Carlos Rodrigues (c) 2003-2006 >>> >>> Megatec protocol UPS detected [ Pro 1400 4.01p]. >>> [ OK ] >>> Starting upsd: Network UPS Tools upsd 2.0.5 >>> Can't connect to UPS [upguards] (upguards): No such file or directory >>> [ OK ] >> >> The startup script is probably not using 'upsdrvctl' to start the >> driver, >> but starts the driver directly. This is wrong. Talk to whoever wrote >> this >> script, we didn't. >> >>> Starting UPS monitor (master): Network UPS Tools upsmon 2.0.5 >>> UPS: upguards at localhost (master) (power value 1) >>> Using power down flag file /etc/killpower >>> >>> [ OK ] >>> [root at corporate all]# >>> Broadcast message from nut (Mon May 28 12:41:24 2007): >>> >>> Communications with UPS upguards at localhost lost >>> >>> Broadcast message from nut (Mon May 28 12:41:29 2007): >>> >>> UPS upguards at localhost is unavailable >> >> Sure, the socket the driver uses has a different name than the server >> expects. >> >>> The ups.conf file contains only these lines: >>> >>> [upguards] >>> driver = megatec >>> port = /dev/ttyS1 >>> desc = "UPguardS Pro 1400" >> >> Your 'ups.conf' file is fine. >> >>> The funny thing is that when the power to the server was not supplied >>> by >>> the ups all worked fine but when i go through the ups the daemon fails. >> >> This is not related. >> >>> I've checked permissions, and i have the user nut that is in the group >>> uucp and that group can read and write to ttyS1 >>> >>> I cannot seem to find who is causing the No such file or directory >>> error >>> message when the daemon starts up. >>> >>> Another weird thing is if i start the driver manually and then the >>> daemon >>> all is fine and working ! >> >> This is indicative for problems in the startup script. >> >> Best regards, Arjen >> -- >> Eindhoven - The Netherlands >> Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57 >> >> > > Thanks for your answer !Please keep the mailinglist posted. Others may benefit from the solution to the problem you experienced.> As i looked through the init.d startup script i see upsdrvctl it's not > used to start the driver instead the script calls the specific driver > binary... > > This procedure is wrong to start the ups daemon ?Yes, and it has been for quite a while actually.> here's the start section of the script:[...] This looks a lot like the standard RedHat script that is included in the NUT sources. This script also uses '/etc/sysconfig/ups' where some parameters can be configured, among these the MODEL (see below): # Model of the UPS (filename to call for it, without path) # Example - one of # apcsmart - APC SMartUPS and similar # fentonups - Fenton UPS # optiups # bestups # genericups # ups-trust425+625 # upsdrvctl # You MUST change this, or set SERVER to "no" # To support multiple drivers, set MODEL=upsdrvctl MODEL=NONE # UPS device - needed if UPS is locally attached DEVICE=/dev/ttyS0 # Any options to pass to $MODEL # ex. for my TrippLite UPS, use # OPTIONS="-t 5" OPTIONS You need to set MODEL to 'upsdrvctl' and configure the UPS in 'ups.conf'. I'm not the maintainer of the RedHat packaging, but I think we need to change something here (remove the configuration of the MODEL, DEVICE and OPTIONS from this file). The old method of starting drivers directly can't be used anymore, since the socketname will be set incorrectly (like you've seen now). The init script should use 'upsdrvctl' to start the driver(s). Best regards, Arjen