[Nut-upsuser] still no nut at reboot

Charles Lepple clepple at gmail.com
Mon Nov 15 14:07:45 UTC 2010


On Nov 15, 2010, at 1:24 AM, Gene Heskett wrote:

> On Monday, November 15, 2010 12:44:21 am Charles Lepple did opine:
>
>> On Nov 14, 2010, at 8:36 PM, Gene Heskett wrote:
> [...]
>>> So, first checking to see if the /etc/init.d/upsd script left
>>> anything I
>>> needed to kill behind, but it didn't, then check the perms on the /
>>> dev/hid*
>>> stuffs and find:
>>> [root at coyote etc]# ls -l /dev/hid*
>>> crw------- 1 root root 250, 0 2010-11-14 20:00 /dev/hidraw0
>>> crw------- 1 root root 250, 1 2010-11-14 20:00 /dev/hidraw1
>>
>> These don't matter for NUT.
>
> Oh?

The /proc/bus/usb/* nodes provide libusb (used by NUT) generic access  
to the USB devices. All of the other USB-related nodes in /dev are  
drivers for higher-level protocols, like USB HID. The /dev/hidraw*  
node corresponding to your UPS will only appear between when you first  
plug in the UPS, and until the first time you successfully run usbhid- 
ups.
>
> 11.
> [root at coyote etc]# /usr/local/ups/bin/upsc coyotes-ups at localhost
> battery.charge: 100
> battery.charge.low: 30
> battery.charge.warning: 30
> battery.runtime: 120
> battery.type: PbAc
> battery.voltage: 27.7
> battery.voltage.nominal: 24
> device.mfr: Belkin
> device.model: Belkin UPS
> device.serial:
> device.type: ups
> driver.name: usbhid-ups
> etc etc
>
> But how about gene?
> [gene at coyote linux-2.6.36]$ /usr/local/ups/bin/upsc coyotes- 
> ups at localhost
> battery.charge: 100
> battery.charge.low: 30
> battery.charge.warning: 30
> battery.runtime: 120
> battery.type: PbAc
> battery.voltage: 27.7
> battery.voltage.nominal: 24
> device.mfr: Belkin
> device.model: Belkin UPS
> device.serial:
> device.type: ups
> driver.name: usbhid-ups
> aka yes!

That part should work for any user on that box, because you are making  
a TCP connection to localhost.

> Ok, how about the init.d/upsd script?
>
> Nope, back to the perms problem
> [root at coyote etc]# /etc/init.d/upsd restart
> nutuser=gene
> nutuser=gene
> NUT Stopping UPS daemon: Network UPS Tools upsd 2.4.3-2672M
>                                                                                                                                                     [
> OK  ]
> NUT Stopping UPS model drivers Network UPS Tools - UPS driver  
> controller
> 2.4.3-2672M
>                                                                                                                                                     [
> OK  ]
> nutuser=gene
> NUT Starting UPS model drivers: Network UPS Tools - UPS driver  
> controller
> 2.4.3-2672M
> Network UPS Tools - Generic HID driver 0.35 (2.4.3-2672M)
> USB communication driver 0.31
> Using subdriver: Belkin HID 0.12
>                                                                                                                                                     [
> OK  ]
> NUT Starting UPS daemon: Network UPS Tools upsd 2.4.3-2672M
> listening on localhost port 3493
> listening on ::1 port 3493
> /var/state/ups is world readable
> Can't open /usr/local/ups/etc/ups.conf: Can't open
> /usr/local/ups/etc/ups.conf: Permission denied
>
> So, how does the nutuser=gene get access to ups.conf? (appending  
> ',gene' to
> the group of ups & nut didn't help.  gene can run it from a cli, but  
> that
> script can't.
>
> I have attached it as it exists now.

Backing up a bit, what is your overall goal of setting nutuser=gene?

We generally recommend setting up separate user and group IDs for nut  
(like the nut/ups pair) because it isolates the permissions a bit. As  
I mentioned, you will still be able to query NUT with upsc over the  
loopback network interface (and even from the local network, given the  
appropriate upsd.conf configuration directives), but if you set up NUT  
to run as your everyday username, that defeats some of the isolation.




More information about the Nut-upsuser mailing list