[Nut-upsuser] Re: newhidups fails only at boot
Jim Osborn
jimo at eskimo.com
Mon Apr 16 22:44:22 UTC 2007
On Mon, Apr 16, 2007 at 5:00:02PM -0300, Peter Selinger wrote:
> Could it be a permissions problem? Perhaps the USB devices are not yet
> owned by the correct user during boot? -- Peter
I thought the hotplug init script, which does execute prior to the
ups init script, was supposed to take care of permissions, but I
have much to learn about all things USB.
> Jim Osborn wrote:
> > ...
> > /etc/hotplug/usb/libhidups:
> > if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
> > chown root:nut "$DEVICE"
> > chmod 0664 "$DEVICE"
> > fi
I can't recall now how Nut gets assigned to its particular USB device,
but somewhere along the installation process I assigned the following
permissions:
crw-r--r-- 1 nut nut 180, 96 Dec 23 01:31 /dev/usb/hiddev0
crw-r--r-- 1 nut nut 180, 97 Dec 23 01:31 /dev/usb/hiddev1
...
crw------- 1 nut nut 188, 1 Sep 23 2001 /dev/usb/ttyUSB1
At least that's what they show now, as I write this, when the driver
CAN find the UPS. I could add some tests/logging to the boot script
to see if the permissions are different then. But maybe I'm not even
looking at the right USB devices. /proc/bus/usb/devices, which we
know is in place before the UPS script runs, shows this:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=051d ProdID=0002 Rev= 1.06
S: Manufacturer=APC
S: Product=Back-UPS ES 750 FW:819.z3.D USB FW:z3
S: SerialNumber=3B0649X61482
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbdevfs
E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=10ms
I could try changing those /dev/usb/hiddev{0,1} devices to root:nut 0664
like the hotplug script, and try probing other USB devices, but somehow
this seems like uninformed thrashing. If someone knows what USB devices
should be set to what permissions it might save me a lot of reboot tests.
I built nut 2.0.5 with --with-user=nut, so the nut:nut ownership of
the hiddev{0,1} devices seemed reasonable.
I'm skeptical, now that I go through this again, that those devices aren't
set to the ownership/permissions that the hotplug script supposedly
sets its device to, so I suspect I'm not even examining the right device.
Surely the permissions wouldn't change between the execution of the
hotplug init script and now, would they? There are NO devices in
/dev/usb/ with ownership root:nut, so maybe that hotplug script isn't
doing its thing after all. I'll sprinkle some more breadcrumbs in
the scripts and see what they hint at...
What's especially confusing, in light of the existing, post-boot,
permissions, is that I CAN start the driver manually.
Anyway, thanks for the response. Any additional clues would be most
welcome.
Jim
More information about the Nut-upsuser
mailing list