Network ups tools (networkupstools) and Clear Linux has anyone got a UPS working with Clear Linux?

Hello all,

I purchased an APC UPS to try and prevent any issues on my Clear Linux home server.

Turns out it’s a rather big issue to install by itself…

The main issue is that the required usbhid-ups driver module is missing.

upsc apcups
Error: Driver not connected
sudo modprobe usbhid-ups
modprobe: FATAL: Module usbhid-ups not found in directory /lib/modules/6.6.9-1394.native

I’m sure I am doing something wrong but I am a bit stuck now… NUT won’t work due to this driver not being loaded.

~ $ lsmod | grep usbhid-ups
~ $ sudo modprobe usbhid-ups
modprobe: FATAL: Module usbhid-ups not found in directory /lib/modules/6.6.9-1394.native

upsd[59771]: Can’t connect to UPS [apcups] (usbhid-ups-apcups): No such file or directory

I’ve tried to compile the drivers from the source code but that’s not working.

I am using the nut bundle. UPS Support: apcupsd or network-ups-tools · Issue #1414 · clearlinux/distribution · GitHub

Surely setting up a UPS for a server OS should not be so complex??? I think I’m going to install Debian server and be done with it, the last week has been an absolute nightmare with Clear Linux (constant network dropouts last time due to an update pushed out)…

So it seems it does not run or build correctly (from source) as libusb-1.0-0-dev is missing which you cannot build and install yourself as it’s not signed (well, not without turning off a secure boot and all the rest). It doesn’t appear to be part of any bundles that I can find.

So it seems Clear Linux is so barebones that it cannot support UPS software! Am I the only one thinking this is pure madness for a server OS?

What is everyone else doing, just letting their servers die when the UPS battery runs out? A power generator is really out of the home user’s options ;).

Cross-posting here:

Hi btwarden,

Thanks for implementing this nut package.

Just to let you know one of the first steps I did was to create a config file which currently resides in /etc/ups and I also tried /etc/nut
Contents of the ups.conf files:
driver = usbhid-ups
port = auto

usbhid-ups is the correct driver for my UPS I checked.

but I have also tried setting the port manually to /dev/bus/usb/001/003 which is where it’s currently connected with no luck either.

As per the linked manual, try starting the configured driver manually to get the full error message:

$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.8.1
Network UPS Tools - Generic HID driver 0.52 (2.8.1)
USB communication driver (libusb 1.0) 0.46
libusb1: Could not open any HID devices: insufficient permissions on everything
No matching HID UPS found
upsnotify: notify about state 4 with libsystemd: was requested, but not running as a service unit now, will not spam more about it
upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it
Driver failed to start (exit status=1)

(obviously I don’t have a USBHID UPS attached to this machine)

Fixed now thanks to btwarden’s help (via messages).

I had setup a group and user called nut but I didn’t realise these came as part of the package as _nut (best practice to avoid any conflicts with standard user accounts called nut). The drivers and daemons run as _nut

These commands fixed it:
to check:
getent group | grep nut
must not have nut must only be _nut

sudo chgrp _nut /dev/bus/usb/001/003

After that the service started fine. A big thanks again to btwarden and now hopefully to many more years of happy Clear Linux usage :slight_smile: apart from this it will probably sit there just doing auto updates and serving containers.

Perhaps I spoke too soon.

sudo systemctl list-units --all | grep nut
  nut-driver@apcups.service                                                                                                   loaded    activating auto-restart Network UPS Tools - device driver for NUT device 'apcups'
  nut-monitor.service                                                                                                         loaded    inactive   dead         Network UPS Tools - power device monitor and shutdown controller
  nut-server.service                                                                                                          loaded    inactive   dead         Network UPS Tools - power devices information server
  system-nut\x2ddriver.slice                                                                                                  loaded    active     active       Slice /system/nut-driver                                                                                                           loaded    inactive   dead         Network UPS Tools - target for power device drivers on this system                                                                                                                  loaded    inactive   dead         Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system

nut-driver@apcups.service: Scheduled restart job, restart counter is at 155.
systemd[1]: Starting nut-driver@apcups.service...
nut-driver@apcups[356850]: Debug level is 0, dump data count is off, but backgrounding mode requested as off
nut-driver@apcups[356850]: Can't claim USB device [051d:0002]@0/0: Entity not found
nut-driver@apcups[356850]: Network UPS Tools - Generic HID driver 0.52 (2.8.1)
nut-driver@apcups[356850]: USB communication driver (libusb 1.0) 0.46
systemd[1]: nut-driver@apcups.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: nut-driver@apcups.service: Failed with result 'exit-code'.
systemd[1]: Failed to start nut-driver@apcups.service.

This is a dumb question are the error messages from trying to restart without rebooting?

As you know many Linux services can be restarted w/o rebooting or power cycling, but
maybe the service nut-driver@apcups.service and related services will not work correctly,
w/o a power cycle or reboot. Perhaps user privilege issue? The shell that starts this
thing needs be root because of other services that are spawned from it need to inherit user root.

Edit based on @btwarden comments below, I see where permission and/or group settings could have cause startup operations to go sideways, i.e. where manual group setting via chgrp of usb device node, in comments 5/9.

BTW: What you are trying to do with UPS management is prudent, I should have some kind of UPS management system going on my server.

No, they’re because of incorrect device permissions/ownership caused by leftover udev rules from manual installation. Out-of-the-box, this should just work.