[Nut-upsuser] Compile/Package / Config/Run 2.8.1 / Raspberry / UPS
Bruce Pleat
bpleat at gmail.com
Mon Feb 19 03:18:58 GMT 2024
I'm trying to Compile/Package and then (on a different box) Config/Run
2.8.1. Both boxes are Raspberry Pi 4b on Bullseye with a generic USB UPS.
--
I'm trying to get nut running on my Raspberry (bullseye/11). (I'd also
love to share a working 2.8.1 for Raspberry with the world, but...)
I compiled the latest code from git: version 2.8.1-774-g963abbd87
I compiled it on one system that does NOT have a UPS, to "package" for my
three other UPS-monitoring systems.
Here's the general history/steps.
(Note: In some places, I did repeat prior steps in different orders, but
did not take detailed notes of every last diagnostic effort...)
(Note: Anywhere I put a semicolon, I did each command separately, but am
simplifying here)
(Note: For each step, I can cite where I found it if desired)
[The next four are just general info, not specific to this build]
[Installed VS Code on my RPi 4 - 8GB if relevant]
[Changed "disable-hardware-acceleration": true]
[Git clone: https://github.com/networkupstools/nut/]
[Installed a bunch of VS Code plugins/addins/whatevers]
[Installed desired-feature prerequisites:] [Note: I did the "configure"
step repeatedly, looked at errors, and then "apt-get install" for needed
items, so I did run it several times...]
apt-get install ccache time git python perl curl make autoconf automake
libltdl-dev libtool valgrind cppcheck pkg-config gcc g++ clan libtool-bin
libxml2-utils xsltproc asciidoc libusb-1.0-0-dev libusb-dev libsystemd-dev
python3-systemd
./autogen.sh
./configure
./configure --enable-dependency-tracking --enable-strip --with-nutconf
--with-usb --with-nut-monitor --with-nut-scanner --with-libsystemd
--with-doc --enable-strip --with-ssl=NO --with-openssl=NO --with-user=ups
--with-group=nut
[Do I also need: "--enable-inplace-runtime"?]
make DESTDIR=/tmp/package install
make DESTDIR=/tmp/package install-conf
[Not sure if needed for Package system, but I did:] mkdir -p
/var/state/ups; chmod 0770 /var/state/ups; chown root:nut /var/state/ups
make all; make; make check; make spellcheck
[Then, since I realized that might not be sufficient for packaging, redid
as follows:]
make all; make DESTDIR=/tmp/package install; make DESTDIR=/tmp/package
install-conf; cd conf; make DESTDIR=/tmp/package install; make
DESTDIR=/tmp/package install-conf ; make install; cd ..; make; make check
&& make spellcheck
[Then tar -compress- it up to move to my desired "run" system]
[Then, of course tar -expand- on run system]
[On the run system]:
useradd ups; groupadd nut
[Also added user "ups" to group "nut":] usermod -a -G nut ups]
mkdir -p /var/state/ups
chmod 0770 /var/state/ups
chown root:nut /var/state/ups
[Copied man pages and reindexed, though not relevant here]
[Then copied / linked from my tar folder as follows]
cp bin/* /bin
ln -s /usr/local/ups/etc /etc/nut
md /lib/ups; cp lib/* /lib/ups/
cp libexec/* /usr/libexec
cp sbin /sbin/
ln -s /usr/local/ups/lib /lib/ups
[Configuration details...]
[Why reinvent the wheel and risk a problem?]
nut-scanner -qUN > /etc/nut/ups.conf
[Configuration of /etc/nut/ups.conf becomes:]
[nutdev-usb1]
driver = "usbhid-ups"
port = "auto"
vendorid = "0764"
productid = "0501"
product = "SL Series"
vendor = "CPS"
# bus = "001"
# device = "049"
# busport = "003"
[Configuration of /etc/nut/nut.conf:]
#MODE=netserver #2024-02-18 - too ambitious to start
MODE=standalone #2024-02-18
ALLOW_NODEVICE=true #2024-02-18
export ALLOW_NO_DEVICE #2024-02-18
ALLOW_NOT_ALL_LISTENERS=true #2024-02-18
export ALLOW_NOT_ALL_LISTENERS #2024-02-18
[All seemed to be defaults in the .sample]
[Configuration of /etc/nut/upsd.conf:]
MAXAGE 15
TRACKINGDELAY 3600
ALLOW_NO_DEVICE true
ALLOW_NOT_ALL_LISTENERS true
STATEPATH /var/run/nut
LISTEN 127.0.0.1 3493
[All but the last seemed to be defaults in the .sample]
[Configuration of /etc/nut/upsd.users:]
[admin]
password = testpass
actions = SET
instcmds = ALL
[actions and instcmds seemed to be admin examples in the .sample]
[Configuration of /etc/nut/upsmon.conf:]
RUN_AS_USER ups
MONITOR nutdev-usb1 at localhost 1 admin testpass primary
# MONITOR usbhid-ups at localhost 1 admin testpass primary
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG "/etc/killpower"
OFFDURATION 30
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
[All but the first two seemed to be defaults in the .sample]
/usr/libexec/nut-driver-enumerator.sh --daemon
usbhid-ups -B -c reload-or-error
[Creating the services - not sure how to autoconfigure these; From <
https://networkupstools.org/docs/user-manual.chunked/ar01s05.html>]
systemd-tmpfiles --create
systemctl enable nut.target nut-driver.target \
nut-monitor nut-server nut-driver-enumerator.path \
nut-driver-enumerator.service
{ sudo systemctl restart udev || true ; } && \
sudo systemctl restart nut-driver-enumerator.service \
nut-monitor nut-server
upsdrvsvcctl resync
<<Results...>>
Service instance 'nut-driver at nutdev.service' did not have a device recorded
into properties, setting to 'nutdev'
OK
Mon 19 Feb 2024 02:22:13 AM UTC : OK: No changes to reconcile between
systemd service instances and device configurations in
'/usr/local/ups/etc/ups.conf'
<<Question: When I run this multiple times, the result is identical,
shouldn't the first line NOT repeat???>>
[I try..]
upsdrvctl -D -d -B start
<<Results...>>
Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87
0.000000 [D1] upsdrvctl commanding all drivers (1 found): (null)
0.000050 [D1] Starting UPS: nutdev
Network UPS Tools - Generic HID driver 0.52 (2.8.1-774-g963abbd87)
USB communication driver (libusb 1.0) 0.46
0.019078 Driver failed to start (exit status=1)
0.019218 [D1] upsdrvctl: got some errors with preceding operations,
exiting with failure now
0.019298 [D1] Completed the job of upsdrvctl tool, cleaning up and
exiting now
0.019322 [D1] Completed the job of upsdrvctl tool, clean-up finished,
exiting now
<<The driver fails to start... how do I fix that? >>
systemctl daemon-reload
<<no output/errors>
[[Ran this once...]]
upsdrvsvcctl reconfigure
<<Results...>>
Dropping old systemd service instance for power device [nutdev] to
reconfigure the service unit...
Removing instance: 'nut-driver at nutdev' ...
Error reading the list of systemd service instances for UPS drivers, or
none are defined - after dropping
Adding new systemd service instance for power device [nutdev]...
Created symlink
/etc/systemd/system/nut-driver.target.wants/nut-driver at nutdev.service →
/lib/systemd/system/nut-driver at nutdev.service.
Enabled instance: 'nut-driver at nutdev' for NUT configuration section 'nutdev'
Adding 'Wants'+After dependency for 'nutdev' on 'systemd-udev.service
systemd-udev-settle.service'...
OK
OK
OK
Started instance: 'nut-driver at nutdev' for NUT configuration section 'nutdev'
OK
=== The currently defined service instances are:
nutdev
=== The currently defined configurations in '/usr/local/ups/etc/ups.conf'
are:
nutdev
Reloading or restarting NUT data server to make sure it knows new
configuration...
Mon 19 Feb 2024 03:06:21 AM UTC : OK: No more changes to reconcile between
systemd service instances and device configurations in
'/usr/local/ups/etc/ups.conf'
<< The "Error" - Is this an issue? If so, how do I diagnose? >>
[Ran it again...]
upsdrvsvcctl reconfigure
<<Results...>
Dropping old systemd service instance for power device [nutdev] to
reconfigure the service unit...
Removing instance: 'nut-driver at nutdev' ...
Removed
/etc/systemd/system/nut-driver.target.wants/nut-driver at nutdev.service.
Failed to reset failed state of unit nut-driver at nutdev.service: Unit
nut-driver at nutdev.service not loaded.
Error reading the list of systemd service instances for UPS drivers, or
none are defined - after dropping
Adding new systemd service instance for power device [nutdev]...
Created symlink
/etc/systemd/system/nut-driver.target.wants/nut-driver at nutdev.service →
/lib/systemd/system/nut-driver at nutdev.service.
Enabled instance: 'nut-driver at nutdev' for NUT configuration section 'nutdev'
Adding 'Wants'+After dependency for 'nutdev' on 'systemd-udev.service
systemd-udev-settle.service'...
OK
OK
OK
Started instance: 'nut-driver at nutdev' for NUT configuration section 'nutdev'
OK
=== The currently defined service instances are:
nutdev
=== The currently defined configurations in '/usr/local/ups/etc/ups.conf'
are:
nutdev
Reloading or restarting NUT data server to make sure it knows new
configuration...
(timestamp purged) OK: No more changes to reconcile between systemd service
instances and device configurations in '/usr/local/ups/etc/ups.conf'
<<Again, how do I diagnose/resolve "Failed" and "Error"?>>
[Tried from some random page]
systemctl start nut-driver-enumerator.service
[no response - assume good]
[More diagnostic tries and errors...]
upsdrvctl start
[First time saw a few errors in journalctl so fixed them and retried all...]
md /var/run/nut #not sure why this was not created
chmod o-rwx /etc/upsd.conf #so not world readable
[Then reran]
upsdrvctl start
<<Response...>>
Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87
Network UPS Tools - Generic HID driver 0.52 (2.8.1-774-g963abbd87)
USB communication driver (libusb 1.0) 0.46
Driver failed to start (exit status=1)
journalctl -xe
<<Results... x is the PID and I strripped before "usbhid-ups">>
usbhid-ups[x]: No matching HID UPS found
usbhid-ups[x]: [D5] send_to_all: SETINFO driver.state "cleanup.exit"
usbhid-ups[x]: upsnotify: notify about state 4 with libsystemd: was
requested, but not running as a service unit now, will not spam more about
it
usbhid-ups[x]: upsnotify: failed to notify about state 4: no notification
tech defined, will not spam more about it
[I then repeated from upsdrvsvcctl reconfigure but no difference]
[Also I tried...]
upsdrvctl start "nutdev-usb1"
<<Results...>>
Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87
UPS nutdev-usb1 not found in ups.conf
<<...which doesn't make sense to me since, again, here's my ups.conf...>>
[nutdev-usb1]
driver = "usbhid-ups"
port = "auto"
vendorid = "0764"
productid = "0501"
product = "SL Series"
vendor = "CPS"
# bus = "001"
# device = "049"
# busport = "003"
####
Okay, how can I further diagnose or change anything or do anything
different?
Thank you (both for making it this far and for any ideas)!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20240218/8b21da13/attachment.htm>
More information about the Nut-upsuser
mailing list