From owner-freebsd-ports@FreeBSD.ORG Sun Feb 3 03:31:21 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 70784AA7 for ; Sun, 3 Feb 2013 03:31:21 +0000 (UTC) (envelope-from areilly@bigpond.net.au) Received: from nskntqsrv03p.mx.bigpond.com (nskntqsrv03p.mx.bigpond.com [61.9.168.237]) by mx1.freebsd.org (Postfix) with ESMTP id E81C7284 for ; Sun, 3 Feb 2013 03:31:20 +0000 (UTC) Received: from nskntcmgw08p ([61.9.169.168]) by nskntmtas03p.mx.bigpond.com with ESMTP id <20130203031541.HVDF10464.nskntmtas03p.mx.bigpond.com@nskntcmgw08p> for ; Sun, 3 Feb 2013 03:15:41 +0000 Received: from johnny.reilly.home ([124.188.162.192]) by nskntcmgw08p with BigPond Outbound id vfFh1k00F49NTNc01fFhnc; Sun, 03 Feb 2013 03:15:41 +0000 X-Authentication-Info: Submitted using ID areilly@bigpond.net.au X-Authority-Analysis: v=2.0 cv=FNuZNpUs c=1 sm=1 a=E3UA96qjU4/DKYBP5EH6OA==:17 a=wom5GMh1gUkA:10 a=rBw6BpehS4wA:10 a=kj9zAlcOel0A:10 a=Sv2sojjTAAAA:8 a=jsrbZVX7j60A:10 a=p6OS3gx4qZbMA9fJmvcA:9 a=CjuIK1q_8ugA:10 a=E3UA96qjU4/DKYBP5EH6OA==:117 Date: Sun, 3 Feb 2013 14:15:41 +1100 From: Andrew Reilly To: freebsd-ports@freebsd.org Subject: sysutils/nut vs 9-stable vs Eaton Ellipse MAX UPS - permissions problem? Message-ID: <20130203031541.GA24537@johnny.reilly.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 03:31:21 -0000 Hi all, Anyone have sysutils/nut successfully configured to talk to a UPS that relies on the usbhid-ups "driver" module? I've been beating my head against it for a couple of days: it tastes close, but still no cigar. The crux of the problem seems to be that usbhid-ups can't do what it needs to do to the usb device after it drops root privs and becomes user uucp, even though the various device files appear to be owned/permissioned appropriately. For example: $ sudo /usr/local/libexec/nut/usbhid-ups -a eaton -DDDDDDD Password: Network UPS Tools - Generic HID driver 0.37 (2.6.5-Unversioned directory) USB communication driver 0.31 0.000000 debug level is '7' 0.000727 upsdrv_initups... 0.000820 No appropriate HID device found 0.000831 No matching HID UPS found $ sudo /usr/local/libexec/nut/usbhid-ups -a eaton -DDDDDDD -u root Network UPS Tools - Generic HID driver 0.37 (2.6.5-Unversioned directory) USB communication driver 0.31 0.000000 debug level is '7' 0.000651 upsdrv_initups... 0.001164 Checking device (0463/FFFF) (/dev/usb//dev/ugen2.2) 0.727679 - VendorID: 0463 0.727702 - ProductID: ffff 0.727706 - Manufacturer: EATON 0.727710 - Product: Ellipse MAX 0.727713 - Serial Number: ADYM20019 0.727716 - Bus: /dev/usb 0.727720 Trying to match device 0.727752 Device matches 6.918371 HID descriptor, method 1: (9 bytes) => 09 21 10 01 21 01 22 72 03 6.918391 i=0, extra[i]=09, extra[i+1]=21 and on and on and on.... If I tweak the /usr/local/etc/rc.d/nut script so that the nut_prestart and nut_poststop functions call upsdrvctl with -u root, then the usbhid-ups driver appears to succeed and do its thing, but then the monitor complains of not being able to open usbhid-ups-eaton, which is presumably the monitoring socket, which winds up being owned by root, rather than uucp. Any pointers or suggestions gratefully accepted! -- Andrew Details: uname -a says: FreeBSD johnny.reilly.home 9.1-STABLE FreeBSD 9.1-STABLE #3 r246214: Sat Feb 2 12:41:06 EST 2013 root@johnny.reilly.home:/usr/obj/usr/src/sys/GENERIC amd64 nut has been installed from ports and is up-to-date. My main config files in /usr/local/etc/nut look like (comments elided): nut.conf: MODE=standalone ups.conf: [eaton] driver = usbhid-ups port = auto vendor = "EATON" product = "Ellipse MAX" vendorid = 0463 productid = ffff offdelay = 120 ondelay = 130 upsd.conf: (unchanged from install) upsd.users: [admin] password = my_ups_pass actions = SET instcmds = ALL [upsmon] password = my_ups_pass upsmon master upsmon.conf: MONITOR eaton@localhost 1 upsmon my_ups_pass master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h +0" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /etc/killpower RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5