Skip to content

Mac OS X Sonoma / Sequoia on Mac Mini M2 - NUT 2.8.2 upsdrvctl / usbhid-ups fail to fork the driver as a daemon process. #2642

Open
@pjkerly

Description

@pjkerly

Mac OS X Sonoma / Sequoia (I have not tried other OS versions) on Mac Mini M2 - NUT 2.8.2 - I can start both upsdrvctl / usbhid-ups as long as it runs in the foreground. As long as I use -D -F -FF with runs in foreground all works as expected. If I try to run in background mode default or with -B, the driver will find the UPS device and run correctly all the way up until it forks the process. Right now, I have workaround but it does not work as expected.

:; sudo ../sbin/upsdrvctl -FF start CP1500PFCLCD 
 
Network UPS Tools - UPS driver controller 2.8.2
Network UPS Tools - Generic HID driver 0.53 (2.8.2)
USB communication driver (libusb 1.0) 0.47
Using subdriver: CyberPower HID 0.80
Running as foreground process, but saving a PID file anyway
upsnotify: failed to notify about state 2: no notification tech defined, will not spam more about it
sock_connect: enabling asynchronous mode (auto)

Then I can stop it successfully using sudo ../sbin/upsdrvctl stop which means that it is generating the PID file success and can use it to stop the driver.

I can also start the usbhid-ups driver manually as well as long as it runs in the foreground. You can see that the driver does find the UPS device and processes correctly just to the point when it would fork the process.

:; sudo ../bin/usbhid-ups -D -B -u root -a CP1500PFCLCD                                                         
Password:
Network UPS Tools - Generic HID driver 0.53 (2.8.2)
USB communication driver (libusb 1.0) 0.47
   0.000000	[D1] upsdrv_makevartable...
   0.000185	[D1] Using USB implementation: libusb-1.0.27 (API: 0x100010a)
   0.000193	[D1] Built-in default or configured user for drivers '_nut' was ignored due to 'root' specified on command line
   0.000534	[D1] Network UPS Tools version 2.8.2 (release/snapshot of 2.8.2) built with Apple clang version 16.0.0 (clang-1600.0.26.3); Target: arm64-apple-darwin24.0.0; Thread model: posix and configured with flags: --prefix=/opt/local --with-serial=no --with-usb=auto --with-snmp=no --with-hal=auto --with-cgi=no --with-neonxml=no --with-ssl=yes --with-ipv6=no --with-statepath=/opt/local/var/db/ups --with-pidpath=/opt/local/var/run --with-hotplug-dir=/opt/local/etc/nut/hotplug --with-udev-dir=/opt/local/etc/nut/udev --with-user=_nut --with-group=_nut
   0.000539	[D1] debug level is '1'
   0.001381	[D1] Succeeded to become_user(root): now UID=0 GID=0
   0.001442	[D1] Saving PID 2939 into /opt/local/var/db/ups/usbhid-ups-CP1500PFCLCD.pid
   0.001485	[D1] upsdrv_initups (non-SHUT)...
   0.029139	Using subdriver: CyberPower HID 0.80
   0.029144	[D1] 53 HID objects found
   0.032078	[D1] Path: UPS.PowerSummary.iProduct, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1
   0.035025	[D1] Path: UPS.PowerSummary.iSerialNumber, Type: Feature, ReportID: 0x02, Offset: 0, Size: 8, Value: 2
   0.038078	[D1] Path: UPS.PowerSummary.ff0100d0, Type: Feature, ReportID: 0x1b, Offset: 0, Size: 8, Value: 5
   0.041063	[D1] Path: UPS.PowerSummary.iDeviceChemistry, Type: Feature, ReportID: 0x03, Offset: 0, Size: 8, Value: 4
   0.044084	[D1] Path: UPS.PowerSummary.iOEMInformation, Type: Feature, ReportID: 0x04, Offset: 0, Size: 8, Value: 3
   0.047075	[D1] Path: UPS.PowerSummary.Rechargeable, Type: Feature, ReportID: 0x05, Offset: 0, Size: 8, Value: 1
   0.050041	[D1] Path: UPS.PowerSummary.CapacityMode, Type: Feature, ReportID: 0x06, Offset: 0, Size: 8, Value: 2
   0.053027	[D1] Path: UPS.PowerSummary.DesignCapacity, Type: Feature, ReportID: 0x07, Offset: 0, Size: 8, Value: 100
   0.053037	[D1] Path: UPS.PowerSummary.CapacityGranularity1, Type: Feature, ReportID: 0x07, Offset: 8, Size: 8, Value: 5
   0.053045	[D1] Path: UPS.PowerSummary.CapacityGranularity2, Type: Feature, ReportID: 0x07, Offset: 16, Size: 8, Value: 10
   0.053053	[D1] Path: UPS.PowerSummary.WarningCapacityLimit, Type: Feature, ReportID: 0x07, Offset: 24, Size: 8, Value: 20
   0.053060	[D1] Path: UPS.PowerSummary.RemainingCapacityLimit, Type: Feature, ReportID: 0x07, Offset: 32, Size: 8, Value: 10
   0.053064	[D1] Path: UPS.PowerSummary.FullChargeCapacity, Type: Feature, ReportID: 0x07, Offset: 40, Size: 8, Value: 100
   0.056030	[D1] Path: UPS.PowerSummary.RemainingCapacity, Type: Input, ReportID: 0x08, Offset: 0, Size: 8, Value: 100
   0.056040	[D1] Path: UPS.PowerSummary.RemainingCapacity, Type: Feature, ReportID: 0x08, Offset: 0, Size: 8, Value: 100
   0.056049	[D1] Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input, ReportID: 0x08, Offset: 8, Size: 16, Value: 8970
   0.056056	[D1] Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, ReportID: 0x08, Offset: 8, Size: 16, Value: 8970
   0.056064	[D1] Path: UPS.PowerSummary.RemainingTimeLimit, Type: Input, ReportID: 0x08, Offset: 24, Size: 16, Value: 300
   0.056066	[D1] Path: UPS.PowerSummary.RemainingTimeLimit, Type: Feature, ReportID: 0x08, Offset: 24, Size: 16, Value: 300
   0.059028	[D1] Path: UPS.PowerSummary.ConfigVoltage, Type: Feature, ReportID: 0x09, Offset: 0, Size: 8, Value: 24
   0.062021	[D1] Path: UPS.PowerSummary.Voltage, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 8, Value: 24
   0.065036	[D1] Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Input, ReportID: 0x0b, Offset: 0, Size: 1, Value: 1
   0.065047	[D1] Path: UPS.PowerSummary.PresentStatus.Charging, Type: Input, ReportID: 0x0b, Offset: 1, Size: 1, Value: 0
   0.065053	[D1] Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Input, ReportID: 0x0b, Offset: 2, Size: 1, Value: 0
   0.065059	[D1] Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Input, ReportID: 0x0b, Offset: 3, Size: 1, Value: 0
   0.065066	[D1] Path: UPS.PowerSummary.PresentStatus.FullyCharged, Type: Input, ReportID: 0x0b, Offset: 4, Size: 1, Value: 1
   0.065068	[D1] Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired, Type: Input, ReportID: 0x0b, Offset: 5, Size: 1, Value: 0
   0.065070	[D1] Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x0b, Offset: 0, Size: 1, Value: 1
   0.065072	[D1] Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x0b, Offset: 1, Size: 1, Value: 0
   0.065074	[D1] Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x0b, Offset: 2, Size: 1, Value: 0
   0.065076	[D1] Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x0b, Offset: 3, Size: 1, Value: 0
   0.065078	[D1] Path: UPS.PowerSummary.PresentStatus.FullyCharged, Type: Feature, ReportID: 0x0b, Offset: 4, Size: 1, Value: 1
   0.065080	[D1] Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired, Type: Feature, ReportID: 0x0b, Offset: 5, Size: 1, Value: 0
   0.068052	[D1] Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x0c, Offset: 0, Size: 8, Value: 2
   0.068059	[D1] Path: UPS.PowerSummary.AudibleAlarmControl, Type: Input, ReportID: 0x0c, Offset: 0, Size: 8, Value: 2
   0.070990	[D1] Path: UPS.PowerSummary.iManufacturer, Type: Feature, ReportID: 0x0d, Offset: 0, Size: 8, Value: 3
   0.074033	[D1] Path: UPS.Input.ConfigVoltage, Type: Feature, ReportID: 0x0e, Offset: 0, Size: 8, Value: 120
   0.077031	[D1] Path: UPS.Input.Voltage, Type: Feature, ReportID: 0x0f, Offset: 0, Size: 16, Value: 119
   0.080036	[D1] Path: UPS.Input.LowVoltageTransfer, Type: Feature, ReportID: 0x10, Offset: 0, Size: 16, Value: 88
   0.080042	[D1] Path: UPS.Input.LowVoltageTransfer, Type: Input, ReportID: 0x10, Offset: 0, Size: 16, Value: 88
   0.080046	[D1] Path: UPS.Input.HighVoltageTransfer, Type: Feature, ReportID: 0x10, Offset: 16, Size: 16, Value: 139
   0.080050	[D1] Path: UPS.Input.HighVoltageTransfer, Type: Input, ReportID: 0x10, Offset: 16, Size: 16, Value: 139
   0.083005	[D1] Path: UPS.Output.Voltage, Type: Feature, ReportID: 0x12, Offset: 0, Size: 16, Value: 119
   0.086030	[D1] Path: UPS.Output.PercentLoad, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 3
   0.089029	[D1] Path: UPS.Output.Test, Type: Feature, ReportID: 0x14, Offset: 0, Size: 8, Value: 6
   0.089033	[D1] Path: UPS.Output.Test, Type: Input, ReportID: 0x14, Offset: 0, Size: 8, Value: 6
   0.092024	[D1] Path: UPS.Output.DelayBeforeShutdown, Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: -60
   0.095017	[D1] Path: UPS.Output.DelayBeforeStartup, Type: Feature, ReportID: 0x16, Offset: 0, Size: 16, Value: -60
   0.098029	[D1] Path: UPS.Output.Boost, Type: Feature, ReportID: 0x17, Offset: 0, Size: 1, Value: 0
   0.098034	[D1] Path: UPS.Output.Overload, Type: Feature, ReportID: 0x17, Offset: 1, Size: 1, Value: 0
   0.100998	[D1] Path: UPS.Output.ConfigActivePower, Type: Feature, ReportID: 0x18, Offset: 0, Size: 16, Value: 900
   0.104010	[D1] Path: UPS.Output.ff010043, Type: Feature, ReportID: 0x1a, Offset: 0, Size: 8, Value: 1
   0.104013	[D1] Path: UPS.Output.ff010043, Type: Input, ReportID: 0x1a, Offset: 0, Size: 8, Value: 1
   0.104021	[D1] Detected a UPS: CPS/CP1500PFCLCD
   0.113121	[D1] upsdrv_initinfo...
   0.113126	[D1] upsdrv_updateinfo...
   0.119052	[D1] Got 6 HID objects...
   0.119064	[D1] Quick update...
   0.119565	[D1] Group and/or user account for this driver was customized ('root:_nut') compared to built-in defaults. Fixing socket '/opt/local/var/db/ups/usbhid-ups-CP1500PFCLCD' ownership/access.
   0.119574	[D1] WARNING: opening socket file for stat/chown failed (102), which is rather typical for Unix socket handling: Operation not supported on socket
   0.119604	[D1] Group access for this driver successfully fixed (using file name based methods)

Metadata

Metadata

Assignees

No one assigned

    Labels

    USBimpacts-release-2.8.2Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks)macOSservice/daemon start/stopGeneral subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions