<div dir="ltr">Hello list,<br><br>I am configuring NUT on a Dell workstation that is connected to an APC Back UPS<br>Pro 1300, and I am running into an issue where starting everything manually<br>seems to be successful, but fails when using the init.d scripts.<br><br>The short story is that I get the following error when trying to check the<br>status of the UPS:<br>[root@mypc:/etc/nut]# upsc apc_pro1300@localhost<br>Error: Connection failure: Connection refused<br><br>If I stop and then restart the service, I get "UPS apc_pro1300@localhost is<br>unavailable" errors walled to the logs and all consoles, but if I stop the<br>service (/etc/init.d/ups-monitor stop) and start the commands individually, all<br>seems fine. I'm pretty sure I'm dealing with a permissions issue, but everything<br>looks fine to me:<br>[root@mypc:/etc/nut]# ls -al /etc/nut<br>total 21<br>drwxr-xr-x   2 root nut  1024 Jan 30 07:56 .<br>drwxr-xr-x 126 root root 9216 Jan 30 13:24 ..<br>-rw-r-----   1 root nut  1543 Jan 30 09:18 nut.conf<br>-rw-r-----   1 root nut    91 Jan 30 09:11 ups.conf<br>-rw-r-----   1 root nut    66 Jan 30 09:11 upsd.conf<br>-rw-r-----   1 root nut   109 Jan 30 09:11 upsd.users<br>-rw-r-----   1 root nut   475 Jan 30 09:12 upsmon.conf<br>-rw-r-----   1 root nut  4075 Jan 30 09:13 upssched.conf<br><br>[root@mypc:/etc/nut]# ls -al /var/run/nut/<br>total 4<br>drwxrwx---  3 root nut   80 Jan 30 14:45 .<br>drwxr-xr-x 25 root root 820 Jan 30 13:29 ..<br>drwxrwx---  2 nut  nut   40 Jan 30 13:46 upssched<br>-rw-r--r--  1 root root   5 Jan 30 13:45 upsmon.pid<br><br>The long story:<br><br>Operating system is Debian Wheezy with NUT installed through aptitude. That<br>installs the nut meta-package which installs the nut-client, nut-server, and the<br>libupsclient1 packages. Following the NUT User Guide for setting it up went<br>almost flawlessly:<br>[root@mypc:/etc/nut]# cat /etc/nut/ups.conf<br>[apc_pro1300]<br>   driver = usbhid-ups<br>   port   = auto<br>   desc   = "APC BackUPS Pro 1300"<br><br><br>[root@mypc:/etc/nut]# /sbin/upsdrvctl start<br>Network UPS Tools - UPS driver controller 2.6.4<br>Network UPS Tools - Generic HID driver 0.37 (2.6.4)<br>USB communication driver 0.32<br>Can't claim USB device [051d:0002]: could not detach kernel driver from<br>interface 0: Operation not permitted<br>Driver failed to start (exit status=1)<br><br>At this point I unplugged the UPS and plugged it into a different USP port, but<br>that did not change the above. Figuring this was likely a udev problem, I<br>created the following /etc/udev/rules.d/52-nut-usbups.rules (based on an example<br>on our database server, and changing the vendor and product id values):<br>[root@mypc:/etc/nut]# cat /etc/udev/rules.d/52-nut-usbups.rules<br>ACTION!="add|change", GOTO="nut-usbups_rules_end"<br>SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"<br>SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"<br>SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"<br><br>LABEL="nut-usbups_rules_real"<br><br># APC - usbhid-ups<br>ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="nut"<br><br>LABEL="nut-usbups_rules_end"<br><br><br>After that, the driver then starts:<br>[root@mypc:/etc/nut]# /sbin/upsdrvctl start<br>Network UPS Tools - UPS driver controller 2.6.4<br>Network UPS Tools - Generic HID driver 0.37 (2.6.4)<br>USB communication driver 0.32<br>Using subdriver: APC HID 0.95<br><br><br>continuing on, I edited /etc/nut/upsd.conf:<br>[root@mypc:/etc/nut]# cat /etc/nut/upsd.conf<br>LISTEN 127.0.0.1 3493<br>LISTEN ::1 3493<br><br><br>Then created /etc/nut/upsd.users:<br>[root@mypc:/etc/nut]# cat /etc/nut/upsd.users<br>[nut]<br>   password  = Password<br>   upsmon      master<br><br><br>And started the data server:<br>[root@mypc:/etc/nut]# /sbin/upsd<br>Network UPS Tools upsd 2.6.4<br>fopen /var/run/nut/upsd.pid: No such file or directory<br>listening on ::1 port 3493<br>listening on 127.0.0.1 port 3493<br>Connected to UPS [apc_pro1300]: usbhid-ups-apc_pro1300<br><br><br>Checking the status, things look good:<br>[root@mypc:/etc/nut]# /bin/upsc apc_pro1300@localhost ups.status<br>OL<br><br><br>Looking at everything, all looked good, so I progressed to testing (the PC is<br>not drawing it's power from the UPS at this point). I took the database server's<br>upsmon.conf as an example and created my own:<br>[root@mypc:/etc/nut]# cat /etc/nut/upsmon.conf<br>FINALDELAY    15<br>HOSTSYNC      15<br>MONITOR       apc_pro1300@localhost 1 nut Password master<br>NOTIFYCMD     /sbin/upssched<br>NOTIFYFLAG    ONLINE    SYSLOG+WALL+EXEC<br>NOTIFYFLAG    ONBATT    SYSLOG+WALL+EXEC<br>NOTIFYFLAG    LOWBATT   SYSLOG+WALL+EXEC<br>NOTIFYFLAG    COMMBAD   SYSLOG+EXEC<br>NOTIFYFLAG    COMMOK    SYSLOG+EXEC<br>NOTIFYFLAG    NOCOMM    SYSLOG+WALL+EXEC<br>POLLFREQ      10<br>POLLFREQALERT 10<br>POWERDOWNFLAG /tmp/killpower<br>RUN_AS_USER   nut<br>SHUTDOWNCMD   "/sbin/shutdown -h +0"<br><br><br>And started the monitor:<br>[root@mypc:/etc/nut]# /sbin/upsmon<br>Network UPS Tools upsmon 2.6.4<br>kill: No such process<br>UPS: apc_pro1300@localhost (master) (power value 1)<br>Using power down flag file /tmp/killpower<br><br><br>Checking the log, that looks good too:<br>Jan 30 09:17:12 mypc usbhid-ups[6688]: Startup successful<br>Jan 30 09:20:37 mypc upsd[6979]: listening on ::1 port 3493<br>Jan 30 09:20:37 mypc upsd[6979]: listening on 127.0.0.1 port 3493<br>Jan 30 09:20:37 mypc upsd[6979]: Connected to UPS [apc_pro1300]: usbhid-ups-apc_pro1300<br>Jan 30 09:20:37 mypc upsd[6980]: Startup successful<br>Jan 30 09:25:11 mypc upsmon[6987]: Startup successful<br>Jan 30 09:25:11 mypc upsd[6980]: User nut@::1 logged into UPS [apc_pro1300]<br><br><br>I then tested a shutdown with the -t flag, and then for real, and the system did<br>shutdown, although the UPS did not power off:<br>sbin/upsmon -c fsd<br><br><br>But on boot up, I noticed the following:<br>Jan 30 09:53:44 mypc upsmon[3298]: Signal 15: exiting<br>Jan 30 09:53:44 mypc upsmon[3296]: upsmon parent: read<br>Jan 30 09:53:44 mypc upsmon[4839]: Startup successful<br>Jan 30 09:53:44 mypc upsmon[4841]: Login on UPS [apc_pro1300@localhost] failed - got [ERR ACCESS-DENIED]<br>Jan 30 09:57:45 mypc upsmon[4841]: Signal 15: exiting<br>Jan 30 09:57:45 mypc upsmon[4839]: upsmon parent: read<br>Jan 30 09:57:45 mypc upsmon[4881]: Startup successful<br>Jan 30 09:57:45 mypc upsd[3128]: User nut@::1 logged into UPS [apc_pro1300]<br><br><br>And I am unable to check the status of the UPS:<br>[root@mypc:/etc/nut]# upsc apc_pro1300@localhost<br>Error: Connection failure: Connection refused<br><br><br>Again, if I stop the service and go through the steps to start everything one at<br>a time, everything seems good and I can check the status.<br><br>Any useful information that I've left out is an oversight on my part, so just<br>ask if additional info is needed. Any hints on my next steps would be appreciated.<br><br>Regards,<br>Melvin</div>