On 12/13/2013 11:57 PM, William D Turner wrote:
Now here's a coincidence. I've just spent a fair part of the last 2 days trying to get NUT working in a new Arch install (2013-12) - it isn't my main system, just trying to understand Arch and systemd so I had a bit of difficulty getting to grips with them. I did not find a great deal of help (on this specific topic) out on the net although there were bits and pieces to be had which finally came together. The package is in the AUR as network-ups-tools and does supply the systemd scripts - I used <yaourt -Sa network-ups-tools> IIRC. The scripts to user are in /usr/lib/systemd/system and after configuring NUT correctly, enabled for reboot with <systemctl enable nut-server.service> and <systemctl start nut-server.service>. The same for nut-monitor.service. Don't try to start nut-driver.service. It is started automatically by the server when needed - so I understand. My UPS is monitored through a serial interface and a problem that did not resolve was the ownership of /dev/ttyS0. Udev (or something) insists on creating the device owned by root and uucp and I could not get around this. Eventually added user ups to the uucp group which solved it rather unsatisfactorily. HTH
Bill
Bill, The hotplugging and udev statefile ownership issues are a pain. nut used to work perfectly on Arch, now I have to kludge it to get it to run. I have built it from the git repository, so I have the latest. I ran into the same ownership problems of the files in /var/state/ups that prevented upsd from starting. (perms were root:root, needed root:nut). In order to get nut to start, I just cheated, I just changed /var/state/ups to be setuid/setgid (ok setgid was all that was needed) So with nut stopped, you can do: # chmod 2770 /var/state/ups That will force the pid files and the device interface ownership that will allow upsd to start. I am using the usb (usbhid) driver, so I had to modify the nut-driver.service before the server would start. For some reason on Arch, "upsdrvctl start" fails to find the usb device and crashes. Changing the Execstart to "/usr/sbin/upsdrvctl -u root start <myups_name>" allows it to find the usb device just fine. With /var/state/ups setgid, the nut-server.service starts perfectly. So I was finally able to enable it in systemd to start on boot. I don't know whether the problem with not finding the driver and /var/state/ups file ownership is with Arch or nut. The problem popped up a while back and I'm just getting time to chase it down. I'll let you know what I get back from the nut-devel list. -- David C. Rankin, J.D.,P.E.