<div dir="ltr"><div>Hello, and thanks for the detailed report.</div><div><br></div><div> Regarding /var/run/nut - I think `systemd-tmpfiles --create` should have taken care of this. Can you check if your tarball "package" actually shipped a /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf file, and does it list (/var)/run/nut among the items it tracks? On the build system, would `grep PATH= config.log` reveal anything? (I suspect the PIDPATH could be defaulted as `(/var)/run` without the `.../nut` suffix)</div><div><br></div><div> Regarding run-time configurations, you did not specify a `--sysconfdir=/etc/nut` so it defaults to using an `etc` dir under the `--prefix` which is also
defaulted in your case:</div><div><br></div><div>
nut-scanner -qUN > /etc/nut/ups.conf
<br>...<br></div><div>
Mon 19 Feb 2024 03:06:21 AM UTC : OK: No more changes to reconcile
between systemd service instances and device configurations<br></div><div> in '/usr/local/ups/etc/ups.conf'
</div><div><br></div><div> I wonder how it finds *something* to claim a "nutdev" configuration, though. Is there something actually written into
/usr/local/ups/etc/ups.conf or is NUT hallucinating (sounds trendy this year, maybe it grew an AI too?) :)<br></div><div><br></div><div>>
[Do I also need: "--enable-inplace-runtime"?]
<br><br></div><div> If you had a previous installation of NUT, perhaps a package, this option helps the `configure` script auto-detect other options like paths and user names for your new build to be a functional replacement of the old one. In particular, this helps with testing of new program iterations right from the build workspace using the same system-wide configs.</div><div><br></div><div>Jim<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 19, 2024 at 4:51 AM Bruce Pleat via Nut-upsuser <<a href="mailto:nut-upsuser@alioth-lists.debian.net">nut-upsuser@alioth-lists.debian.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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.</div><div><br></div><div>--</div><div><br></div>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...)<br><br>I compiled the latest code from git: version 2.8.1-774-g963abbd87<br>I compiled it on one system that does NOT have a UPS, to "package" for my three other UPS-monitoring systems.<br><br>Here's the general history/steps.<div><br></div><div>(Note: In some places, I did repeat prior steps in different orders, but did not take detailed notes of every last diagnostic effort...)<br><br>(Note: Anywhere I put a semicolon, I did each command separately, but am simplifying here)<br>(Note: For each step, I can cite where I found it if desired)<br><br>[The next four are just general info, not specific to this build]<br>[Installed VS Code on my RPi 4 - 8GB if relevant]<br>[Changed "disable-hardware-acceleration": true]<br>[Git clone: <a href="https://github.com/networkupstools/nut/" target="_blank">https://github.com/networkupstools/nut/</a>]<br>[Installed a bunch of VS Code plugins/addins/whatevers]<br><br>[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...]<br>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<br>./autogen.sh<br>./configure<br>./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<br>[Do I also need: "--enable-inplace-runtime"?]<br>make DESTDIR=/tmp/package install<br>make DESTDIR=/tmp/package install-conf<br>[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<br>make all; make; make check; make spellcheck<br>[Then, since I realized that might not be sufficient for packaging, redid as follows:]<br>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<br>[Then tar -compress- it up to move to my desired "run" system]<br><br>[Then, of course tar -expand- on run system]<br>[On the run system]:<br>useradd ups; groupadd nut<br>[Also added user "ups" to group "nut":] usermod -a -G nut ups]<br><br><br>mkdir -p /var/state/ups<br>chmod 0770 /var/state/ups<br>chown root:nut /var/state/ups<br><br>[Copied man pages and reindexed, though not relevant here]<br><br>[Then copied / linked from my tar folder as follows]<br>cp bin/* /bin<br>ln -s /usr/local/ups/etc /etc/nut<br>md /lib/ups; cp lib/* /lib/ups/<br>cp libexec/* /usr/libexec<br>cp sbin /sbin/<br>ln -s /usr/local/ups/lib /lib/ups<br><br>[Configuration details...]<br><br>[Why reinvent the wheel and risk a problem?]<br>nut-scanner -qUN > /etc/nut/ups.conf<br><br>[Configuration of /etc/nut/ups.conf becomes:]<br> [nutdev-usb1]<br> driver = "usbhid-ups"<br> port = "auto"<br> vendorid = "0764"<br> productid = "0501"<br> product = "SL Series"<br> vendor = "CPS"<br> # bus = "001"<br> # device = "049"<br> # busport = "003"<br><br>[Configuration of /etc/nut/nut.conf:]<br> #MODE=netserver #2024-02-18 - too ambitious to start<br> MODE=standalone #2024-02-18<br> ALLOW_NODEVICE=true #2024-02-18<br> export ALLOW_NO_DEVICE #2024-02-18<br> ALLOW_NOT_ALL_LISTENERS=true #2024-02-18<br> export ALLOW_NOT_ALL_LISTENERS #2024-02-18<br>[All seemed to be defaults in the .sample]<br><br><br>[Configuration of /etc/nut/upsd.conf:]<br> MAXAGE 15<br> TRACKINGDELAY 3600<br> ALLOW_NO_DEVICE true<br> ALLOW_NOT_ALL_LISTENERS true<br> STATEPATH /var/run/nut<br> LISTEN 127.0.0.1 3493<br>[All but the last seemed to be defaults in the .sample]<br><br>[Configuration of /etc/nut/upsd.users:]<br> [admin]<br> password = testpass<br> actions = SET<br> instcmds = ALL<br>[actions and instcmds seemed to be admin examples in the .sample]<br><br><br><br>[Configuration of /etc/nut/upsmon.conf:]<br> RUN_AS_USER ups<br> MONITOR nutdev-usb1@localhost 1 admin testpass primary<br># MONITOR usbhid-ups@localhost 1 admin testpass primary<br> MINSUPPLIES 1<br> SHUTDOWNCMD "/sbin/shutdown -h +0"<br> POLLFREQ 5<br> POLLFREQALERT 5<br> HOSTSYNC 15<br> DEADTIME 15<br> POWERDOWNFLAG "/etc/killpower"<br> OFFDURATION 30<br> RBWARNTIME 43200<br> NOCOMMWARNTIME 300<br> FINALDELAY 5<br>[All but the first two seemed to be defaults in the .sample]<br><br>/usr/libexec/nut-driver-enumerator.sh --daemon<br>usbhid-ups -B -c reload-or-error<br><br>[Creating the services - not sure how to autoconfigure these; From <<a href="https://networkupstools.org/docs/user-manual.chunked/ar01s05.html" target="_blank">https://networkupstools.org/docs/user-manual.chunked/ar01s05.html</a>>]<br><br>systemd-tmpfiles --create<br>systemctl enable nut.target nut-driver.target \<br> nut-monitor nut-server nut-driver-enumerator.path \<br> nut-driver-enumerator.service<br>{ sudo systemctl restart udev || true ; } && \<br> sudo systemctl restart nut-driver-enumerator.service \<br> nut-monitor nut-server<br><br>upsdrvsvcctl resync<br><<Results...>><br>Service instance 'nut-driver@nutdev.service' did not have a device recorded into properties, setting to 'nutdev'<br>OK<br>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'<br><<Question: When I run this multiple times, the result is identical, shouldn't the first line NOT repeat???>><br><br>[I try..]<br>upsdrvctl -D -d -B start<br><<Results...>><br>Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87<br> 0.000000 [D1] upsdrvctl commanding all drivers (1 found): (null)<br> 0.000050 [D1] Starting UPS: nutdev<br>Network UPS Tools - Generic HID driver 0.52 (2.8.1-774-g963abbd87)<br>USB communication driver (libusb 1.0) 0.46<br> 0.019078 Driver failed to start (exit status=1)<br> 0.019218 [D1] upsdrvctl: got some errors with preceding operations, exiting with failure now<br> 0.019298 [D1] Completed the job of upsdrvctl tool, cleaning up and exiting now<br> 0.019322 [D1] Completed the job of upsdrvctl tool, clean-up finished, exiting now<br><<The driver fails to start... how do I fix that? >><br><br>systemctl daemon-reload<br><<no output/errors><br><br>[[Ran this once...]]<br>upsdrvsvcctl reconfigure<br><<Results...>><br>Dropping old systemd service instance for power device [nutdev] to reconfigure the service unit...<br>Removing instance: 'nut-driver@nutdev' ...<br>Error reading the list of systemd service instances for UPS drivers, or none are defined - after dropping<br>Adding new systemd service instance for power device [nutdev]...<br>Created symlink /etc/systemd/system/nut-driver.target.wants/nut-driver@nutdev.service → /lib/systemd/system/nut-driver@nutdev.service.<br>Enabled instance: 'nut-driver@nutdev' for NUT configuration section 'nutdev'<br>Adding 'Wants'+After dependency for 'nutdev' on 'systemd-udev.service systemd-udev-settle.service'...<br>OK<br>OK<br>OK<br>Started instance: 'nut-driver@nutdev' for NUT configuration section 'nutdev'<br>OK<br>=== The currently defined service instances are:<br>nutdev<br>=== The currently defined configurations in '/usr/local/ups/etc/ups.conf' are:<br>nutdev<br>Reloading or restarting NUT data server to make sure it knows new configuration...<br>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'<br><< The "Error" - Is this an issue? If so, how do I diagnose? >><br><br>[Ran it again...]<br>upsdrvsvcctl reconfigure<br><<Results...><br>Dropping old systemd service instance for power device [nutdev] to reconfigure the service unit...<br>Removing instance: 'nut-driver@nutdev' ...<br>Removed /etc/systemd/system/nut-driver.target.wants/nut-driver@nutdev.service.<br>Failed to reset failed state of unit nut-driver@nutdev.service: Unit nut-driver@nutdev.service not loaded.<br>Error reading the list of systemd service instances for UPS drivers, or none are defined - after dropping<br>Adding new systemd service instance for power device [nutdev]...<br>Created symlink /etc/systemd/system/nut-driver.target.wants/nut-driver@nutdev.service → /lib/systemd/system/nut-driver@nutdev.service.<br>Enabled instance: 'nut-driver@nutdev' for NUT configuration section 'nutdev'<br>Adding 'Wants'+After dependency for 'nutdev' on 'systemd-udev.service systemd-udev-settle.service'...<br>OK<br>OK<br>OK<br>Started instance: 'nut-driver@nutdev' for NUT configuration section 'nutdev'<br>OK<br>=== The currently defined service instances are:<br>nutdev<br>=== The currently defined configurations in '/usr/local/ups/etc/ups.conf' are:<br>nutdev<br>Reloading or restarting NUT data server to make sure it knows new configuration...<br>(timestamp purged) OK: No more changes to reconcile between systemd service instances and device configurations in '/usr/local/ups/etc/ups.conf'<br><<Again, how do I diagnose/resolve "Failed" and "Error"?>><br><br><br>[Tried from some random page]<br>systemctl start nut-driver-enumerator.service <br>[no response - assume good]<br><br>[More diagnostic tries and errors...]<br>upsdrvctl start <br>[First time saw a few errors in journalctl so fixed them and retried all...]<br>md /var/run/nut #not sure why this was not created<br>chmod o-rwx /etc/upsd.conf #so not world readable<br>[Then reran]<br>upsdrvctl start <br><<Response...>><br>Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87<br>Network UPS Tools - Generic HID driver 0.52 (2.8.1-774-g963abbd87)<br>USB communication driver (libusb 1.0) 0.46<br>Driver failed to start (exit status=1)<br><br>journalctl -xe<br><<Results... x is the PID and I strripped before "usbhid-ups">><br>usbhid-ups[x]: No matching HID UPS found<br>usbhid-ups[x]: [D5] send_to_all: SETINFO driver.state "cleanup.exit"<br>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<br>usbhid-ups[x]: upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it<br><br>[I then repeated from upsdrvsvcctl reconfigure but no difference]<br><br>[Also I tried...]<br>upsdrvctl start "nutdev-usb1"<br><<Results...>><br>Network UPS Tools - UPS driver controller 2.8.1-774-g963abbd87<br>UPS nutdev-usb1 not found in ups.conf<br><<...which doesn't make sense to me since, again, here's my ups.conf...>><br>[nutdev-usb1]<br> driver = "usbhid-ups"<br> port = "auto"<br> vendorid = "0764"<br> productid = "0501"<br> product = "SL Series"<br> vendor = "CPS"<br> # bus = "001"<br> # device = "049"<br> # busport = "003"<br><br>####<br><br>Okay, how can I further diagnose or change anything or do anything different?<br></div><div><br></div><div>Thank you (both for making it this far and for any ideas)!</div><div><br></div><div><br></div></div>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>