NUT Can't chdir to /var/db/nut: Permission denied EATON
-
Hi folks
Hope you're doing well.
I got this issue with my nut configuration. I'm tryining to use the usbhid driver to make it work.
i've read those interesting posts about the usb permissions issues :
https://forums.freebsd.org/threads/trying-to-get-nut-to-work.59966/
https://forums.freebsd.org/threads/nut-port-configuration-no-such-file.35205/
https://people.freebsd.org/~thierry/nut_FreeBSD_HowTo.txtbut after applying the advices and changed the conf i'm still stucked with a non-functionning nut daemon.
Main problem is permission problem :
[2.7.0-RELEASE][root@pf]/root: upsdrvctl start ups Network UPS Tools - UPS driver controller 2.8.0 Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 Can't chdir to /var/db/nut: Permission denied Driver failed to start (exit status=1) [2.7.0-RELEASE][root@pf]/root: upsdrvctl -u root start ups Network UPS Tools - UPS driver controller 2.8.0 Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 Using subdriver: MGE HID 1.46 Broadcast Message from root@pf-mery.mery (no tty) at 14:45 CEST... Communications with UPS ups established
When i define the -u root user it works for a moment.
I defined a rule and applied a conf in /etc/devfs.rules and /etc/devfs.conf restarted the services as mentionned but with no luck.
but after restarting the services some files popped up in /var/db/nut/ with thos permissions.
total 13 drwxrwx--- 2 uucp wheel 256B Aug 31 16:01 . drwxr-xr-x 9 root wheel 832B Aug 31 15:56 .. -rwxrwx--- 1 uucp wheel 6B Aug 31 15:58 upsd.pid -rwxrwx--- 1 uucp wheel 6B Aug 31 16:03 upsmon.pid srwxrwx--- 1 root nut 0B Aug 31 16:01 usbhid-ups-ups -rwxrwx--- 1 root wheel 6B Aug 31 16:01 usbhid-ups-ups.pid
I'm a little puzzled now.
As pfsense is different from freebsd i was curious if i should apply the conf/rules of /etc/devfs.rules and /etc/devfs.conf withroot:uucp uucp:wheel root:nut nut:uucp
or if i should instead play with the /var/db/nut wich seems to change permissions of files within on the fly.
Do some wizard here have a magic hint for me ?
Thank you very much.
Have a nice day.
Regards.
-
@abs0new said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
total 13
drwxrwx--- 2 uucp wheel 256B Aug 31 16:01 .
drwxr-xr-x 9 root wheel 832B Aug 31 15:56 ..
-rwxrwx--- 1 uucp wheel 6B Aug 31 15:58 upsd.pid
-rwxrwx--- 1 uucp wheel 6B Aug 31 16:03 upsmon.pid
srwxrwx--- 1 root nut 0B Aug 31 16:01 usbhid-ups-ups
-rwxrwx--- 1 root wheel 6B Aug 31 16:01 usbhid-ups-ups.pidMine :
Why would you have to start stop manipulate processes like this manually ,
-
-
'nut' is the owner when installed :
[23.05.1-RELEASE][root@pfSense.bhf.net]/var/db: ls -al | grep 'nut' drwxr-x--- 2 nut nut 6 Aug 31 15:54 nut
-
@Gertjan said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
ls -al | grep 'nut'
Thank you for your answers @Gertjan and @dennypage
I did :
chown nut /var/db/nut
now i got :
ls -lah /var/db/nut drwxrwx--- 2 nut wheel 128B Sep 1 10:46 . drwxr-xr-x 9 root wheel 832B Sep 1 02:55 .. -rw-r--r-- 1 root wheel 6B Sep 1 10:45 upsd.pid -rwxrwxr-- 1 root wheel 6B Sep 1 10:45 upsmon.pid
then i resaved the conf, it automaticaly restart the services.
I still got this logs errors :2023-09-01 10:45:53.791053+02:00 upsmon 47178 UPS ups is unavailable 2023-09-01 10:45:53.791015+02:00 upsmon 47178 Poll UPS [ups] failed - Driver not connected 2023-09-01 10:45:53.790711+02:00 upsd 49368 User local-monitor@::1 logged into UPS [ups] 2023-09-01 10:45:49.815818+02:00 upsd 49368 Startup successful 2023-09-01 10:45:49.786932+02:00 upsd 49091 Can't connect to UPS [ups] (usbhid-ups-ups): No such file or directory
but now when i try do launch manually with :
upsdrvctl -D start ups
i got this slightly different messages :
Network UPS Tools - UPS driver controller 2.8.0 0.000000 [D1] Starting UPS: ups Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 libusb1: Could not open any HID devices: no USB buses found No matching HID UPS found 0.003886 Driver failed to start (exit status=1)
the permission denied disappeared that's a good start.
You may need to check my configuration (done from GUI)
*usb type : local usb
ups name : ups
enable notifications : true
driver : usbhidupsd.users :
[monuser]
password = secret*i tried to keep it simple but it seems to be a driver problem not a communication between server and pfsense.
from server i can contact the specified port :
nc -zv 10.0.200.2 3493 Connection to 10.0.200.2 3493 port [tcp/nut] succeeded!
EDIT : for a more verbose log output :
Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 0.000000 [D3] main_arg: var='driver' val='usbhid-ups' 0.000030 [D3] main_arg: var='port' val='auto' 0.000051 [D5] send_to_all: SETINFO driver.parameter.port "auto" 0.000077 [D1] debug level is '5' 0.000672 [D5] send_to_all: SETINFO device.type "ups" 0.000691 [D2] Initializing an USB-connected UPS with library libusb-1.0.0 (API: 0x1000102) (NUT subdriver name='USB communication driver (libusb 1.0)' ver='0.43') 0.000699 [D1] upsdrv_initups (non-SHUT)... 0.000961 [D2] libusb1: No appropriate HID device found 0.000975 libusb1: Could not open any HID devices: no USB buses found 0.000981 No matching HID UPS found
-
@abs0new said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
I did :
chown nut /var/db/nut
now i got :
ls -lah /var/db/nut
drwxrwx--- 2 nut wheel 128B Sep 1 10:46 .
drwxr-xr-x 9 root wheel 832B Sep 1 02:55 ..
-rw-r--r-- 1 root wheel 6B Sep 1 10:45 upsd.pid
-rwxrwxr-- 1 root wheel 6B Sep 1 10:45 upsmon.pidThe chown command doesn't touch/changes the files IN the /var/db/nut/ folder, the ones you've shown.
It changes the owner of the nut folder, see my example above. -
@Gertjan right
so i need to change the file's permission within the /var/db/nut directory ?
like :
chown -R nut:nut /var/db/nut/
?
EDIT: maybe reinstalling the package can restore the initial permissions ?
i think i restored the correct permissions on the directory as foolows :
ls -lah /var/db/nut/ total 9 drwxrwx--- 2 nut nut 128B Sep 1 11:15 . drwxr-xr-x 9 root wheel 832B Sep 1 02:55 .. -rw-r--r-- 1 root nut 6B Sep 1 10:45 upsd.pid -rw-r--r-- 1 root uucp 6B Sep 1 10:45 upsmon.pid
-
@abs0new said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
EDIT: maybe reinstalling the package can restore the initial permissions ?
-
That's a good news.
but unfortuntely i still can't roperly start the driver./usr/local/libexec/nut/usbhid-ups -a ups -DD
Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 0.000000 [D3] main_arg: var='driver' val='usbhid-ups' 0.000030 [D3] main_arg: var='port' val='auto' 0.000051 [D5] send_to_all: SETINFO driver.parameter.port "auto" 0.000077 [D1] debug level is '5' 0.000672 [D5] send_to_all: SETINFO device.type "ups" 0.000691 [D2] Initializing an USB-connected UPS with library libusb-1.0.0 (API: 0x1000102) (NUT subdriver name='USB communication driver (libusb 1.0)' ver='0.43') 0.000699 [D1] upsdrv_initups (non-SHUT)... 0.000961 [D2] libusb1: No appropriate HID device found 0.000975 libusb1: Could not open any HID devices: no USB buses found 0.000981 No matching HID UPS found
it may be related with the /etc/devfs.conf /etc/devfs.rules.
I think i should reboot the pfsense as mentionned in troubleshooting here :
https://blog.victormendonca.com/2020/10/28/how-to-setup-ups-on-pfsense/
but as it is in production i need to wait .
I'll try to tweak the devfs rules/conf .
-
@Gertjan said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
'nut' is the owner when installed
Look at line 57 in nut.inc.
It's one of the things I need to fix in the transition from using a release version of nut to using the development version of nut.
I won't be able to get to it until end of next week.
-
@abs0new said in NUT Can't chdir to /var/db/nut: Permission denied EATON:
I'll try to tweak the devfs rules/conf .
Should not be needed.
Can you run the following:
- disable the UPS service and save
- unplug the usb connection and wait a few seconds
- re-plug the usb connection
- run "usbconfig -v" in a shell
- re-enable the UPS service and save
- run the usbconfig command again
And post the results please?
-
Thank you it worked !
I changed the usb cable in case it was malfunctioning.
I also changed the usb port : from ugen1.3 to ugen0.6at some point i needed to chown back the /var/db/nut directory to nut:nut with
chown -R nut:nut: /var/db/nut/
here is the output of usbconfig -v :
ugen0.6: <EATON Eaton 5P> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (20mA) bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x0000 <Probed by interface class> bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0008 idVendor = 0x0463 idProduct = 0xffff bcdDevice = 0x0202 iManufacturer = 0x0001 <EATON> iProduct = 0x0002 <Eaton 5P> iSerialNumber = 0x0003 <G117L13177> bNumConfigurations = 0x0001 Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x0022 bNumInterfaces = 0x0001 bConfigurationValue = 0x0001 iConfiguration = 0x0000 <no string> bmAttributes = 0x00a0 bMaxPower = 0x000a Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0001 bInterfaceClass = 0x0003 <HID device> bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x10 RAW dump: 0x00 | 0x09, 0x21, 0x10, 0x01, 0x21, 0x01, 0x22, 0x25, 0x08 | 0x04 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0003 <INTERRUPT> wMaxPacketSize = 0x0008 bInterval = 0x0014 bRefresh = 0x0000 bSynchAddress = 0x0000
when i restarted the driver with :
/usr/local/libexec/nut/usbhid-ups -dddd -a up
i got :
Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 Using subdriver: MGE HID 1.46 Broadcast Message from root@pf (no tty) at 15:26 CEST... Communications with UPS ups established
i also restarted the service via the webui and it worked.
So i'm monitoring the service in case anything goes wrong.
Do you think i may need to tweak the driver's conf with some of this option :
for example :
waitbeforereconnect=30
i'll keep this post open so i can confirm it works flawlessly next week after another reboot.
Thank you very much for help.
-
@abs0new Unfortunately, the issue of ownership of /var/db/nut will currently arise every time you reboot.
To remediate, you can either edit nut.inc, add a boot time shell script, or wait until I can fix the package.