[Nut-upsuser] still no nut at reboot

Gene Heskett gene.heskett at gmail.com
Mon Nov 15 06:24:49 UTC 2010


On Monday, November 15, 2010 12:44:21 am Charles Lepple did opine:

> On Nov 14, 2010, at 8:36 PM, Gene Heskett wrote:
> > ok, back after the reboot to get everything on the same page again,
> > or so I
> > thought.  Silly me.
> > 
> > now, I have a ups.conf containing this:
> > 
> > [root at coyote etc]# cat ups.conf
> > [coyotes-ups]
> > 
> >                driver = usbhid-ups
> >                port = auto
> >                desc = "Belkin ups usb interface"
> 
> Looks good.

Ok.  We'll finish pouring the cement then. :)
 
> > 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?
 
> > So I am at step 8 of the INSTALL printout.
> > ------------------------------------------------------
> > [root at coyote ~]# /usr/local/ups/bin/upsdrvctl start
> > 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
> > 
> > Fatal error: unable to create listener socket
> > 
> > bind /var/state/ups/usbhid-ups-coyotes-ups failed: Permission denied

Aha, ups owned by root:415.  Nuts number changed and I didn't fix it.  Have 
now, and it works:
[root at coyote etc]# /usr/local/ups/bin/upsdrvctl start
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
[root at coyote etc]# 

So I'm past that (again).  On to step 9:
[root at coyote etc]# cat upsd.conf
LISTEN ::1 3493
LISTEN localhost 3493

[root at coyote etc]# cat upsd.users
[gene]
                password = gh10041934
                actions = set, fsd
                instcmds = all
                upsmon master

Looks ok, so step 10
[root at coyote etc]# /usr/local/ups/sbin/upsd
Network UPS Tools upsd 2.4.3-2672M
listening on localhost port 3493
listening on ::1 port 3493
/var/state/ups is world readable
Connected to UPS [coyotes-ups]: usbhid-ups-coyotes-ups

looks ok.
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!

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.

 
> The upsdrvctl program will drop privileges to the user name that you
> specified when running ./configure. You can temporarily bypass this by
> adding "-u root" to the command line, but afterwards, you will want to
> check step 5 (a "chmod" on the state path, a.k.a. listener socket
> directory).

That was as stated in the INSTALL file.

> 
> > Exiting.
> > Driver failed to start (exit status=1)
> > -------then--------
> > [root at coyote ~]# lsusb |grep elkin
> > Bus 002 Device 008: ID 050d:0751 Belkin Components
> 
> This corresponds to either /proc/bus/usb/002/008 or /dev/usb/002/008.
> *That* is the USB node which the udev rules should be changing the
> permissions on.
> 
> > So lets stop right here and fix this.  First:
> > 
> > [root at coyote etc]# grep ups /etc/passwd
> > ups:x:502:504::/home/ups:/bin/bash
> > 
> > There is no 'nut' in /etc/passwd now.
> > 
> > and:
> > [root at coyote etc]# grep nut /etc/group
> > nut:x:503:ups
> > 
> > 
> > The whole thing has been rebuilt and reinstalled, but the .conf
> > and .user
> > files are still there.
> > 
> > And I see the hacked mdv script to start it doesn't have a link in
> > /etc/rc5.d, so it did not attempt to run at bootup.
> > 
> > Whats next coach?  I'm going blind staring at this, and probably
> > missing
> > something obvious, like hacking on the 52-* udev script some more to
> > change
> > some perms?  FWIW, changing all the 'ATTR' to 'ATTRS' shut it up
> > completely.  This was udev complaining about a deprecated format.
> > Other
> > than the spelling, I didn't change anything else.
> 
> Sigh. Good to know that we will need to update that at some point. (I
> wonder how many older udev installations we will break if we change
> that now? Guess we could ship two copies.)
> 
> What does "udevadm --version" say? (My second attempt at the pclos VM
> is still booting - I gave it more RAM this time, but it's still making
> molasses look like a speed demon.)

I have 4Gb here, with a slow phenom 9550, asus m2n sli deluxe board. pclos 
is the snappiest os I've had on this box in yonks.

[root at coyote etc]# udevadm --version
156

Take a look at that starter script I attached & see where it needs help if 
you can, and thanks, Charles.  I'm going back to bed. ;-)

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
While you don't greatly need the outside world, it's still very
reassuring to know that it's still there.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: upsd
Type: application/x-shellscript
Size: 3629 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20101115/5ee430bb/attachment.bin>


More information about the Nut-upsuser mailing list