[Nut-upsdev] /sbin/upsdrvctl unable to shutdown UPS ...

Alfred Ganz alfred-ganz+nut at agci.com
Sat Aug 8 20:49:40 UTC 2009


Charles,
	From: Charles Lepple <clepple at gmail.com>
	Subject: Re: [Nut-upsdev] /sbin/upsdrvctl unable to shutdown UPS ...
	Date: Sat, 8 Aug 2009 10:43:26 -0400
	>When sorting out the library problem for shutdown, please also keep in
	>mind that the shutdown scripts (at least those that I have encountered
	>so far) insist on unmounting /dev/usb. This requires that libusb does
	>not rely on its presence to do the reconnection for the shutdown. I  
	>don't
	>know if this is a part of the definition of the functionality of  
	>libusb
	>and if it can safely be relied upon.
	that does pose a problem - /dev/usb is required by libusb on Linux.
	
	I wonder if the hiddev nodes in /dev still exist at that point?
I remembered my halt script hacks slightly wrong, the problem originates 
with the unmounting of the usb file system.
Here is what centos-5 removes before we get to the end of the halt script:
	[ -f /proc/bus/usb/devices ] && $UMOUNT /proc/bus/usb
/proc/bus/usb is invisibly mounted at startup:
	mount -n -t usbfs /proc/bus/usb /proc/bus/usb
The addition of a new usb device results in both the creation of an 
entry in this subtree as well as in the creation of the corresponding 
/dev/usb* entries. Since removal of an existing usb device results both
in the removal of the associated subtree entry as well as in the removal
of the corresponding /dev/usb* devices I assume that the above umount
will do similar removals (I suspect I actually tested this at some point
in time, but I don't want to verify it right now). Anyhow, the umount 
would in turn result in the removal of any trace of the usb UPS.

My current hacks basically suppress the above umount which is attempted
a couple of times, and after that there is a remount read only which also
may cause trouble.

However, I really think the *right* way to proceed might be a rearranged
order of the halt script, that triggers a delayed shutdown earlier in
the script when everything can still be done. This would hopefully also
address the issue of required libraries in a separately mounted /usr/lib.

Note1, since nut removes itself from the hid device, I presume that this
	involves removal of any corresponding /dev entries (in any case 
	I see none on my system, there are two entries for the UPS:
	/dev/usbdev2.2_ep00 and /dev/usbdev2.2_ep81).
Note2, this whole usb situation has been in flux in the past, so it is
	important to note that centos-5 uses the udev system for handling
	addition and removal of devices. I don't know what happens when
	udev is not used.
AG

-- 
 ----------------------------------------------------------------------
   Alfred Ganz					alfred-ganz:at:agci.com
   AG Consulting, Inc.				(203) 624-9667
   440 Prospect Street # 11
   New Haven, CT 06511
 ----------------------------------------------------------------------



More information about the Nut-upsdev mailing list