<div dir="auto">Yes, the bug was about conversion of `upsdebugx()` and friends to macros, so actual methods (and their parameter evaluations) only waste CPU cycles when the verbosity level is high enough. Otherwise lots of logic was executed to prepare method arguments only for it to bail out in the first line.<div dir="auto"><br></div><div dir="auto">In a couple of cases (addressed by that PR referenced in the thread) this change left "production" logic overboard unless it was debug-printed, hence this failure.</div><div dir="auto"><br></div><div dir="auto">Can't phone-type an article on building NUT now, but there should be a few pages on that in Wiki, including one referenced earlier. Otherwise, I guess, you can find a packaging recipe from distro ("debian" dir is their turf) and add a patch equivalent to that PR...</div><div dir="auto"><br></div><div dir="auto">Jim</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 5, 2023, 22:49 Karl Schmidt <<a href="mailto:karl@lrak.net">karl@lrak.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 7/5/23 03:17AM, Jim Klimov wrote:<br>
> Ah, I thought you missed in my earlier reply the part about a bug with debug printouts in 2.8.0 (fixed on master since), <br>
> did not comment on that when you replied with quoting... So, for now options are to bump debugging to 3+ or to build <br>
> your own in one of many ways possible :\<br>
<br>
I think I'm not following you - with debug 3 -->> it WORKS -- without debug it fails. (even debug 2 fails).<br>
<br>
Could be you want me to build a version off of github?<br>
<br>
I see there isn't anything is sid or experimental ..<br>
<br>
I'm rusty at building packages (keeps changing) - do you have a build script?<br>
<br>
git clone <a href="https://github.com/networkupstools/nut" rel="noreferrer noreferrer" target="_blank">https://github.com/networkupstools/nut</a><br>
<br>
-- no debian directory ?<br>
<br>
<br>
<br>
<br>
------------------------------<br>
With debug =2<br>
<br>
:02.557753-05:00 malaysia systemd[1]: Starting nut-driver@malaysia.service - Network UPS Tools - device driver for <br>
malaysia...<br>
2023-07-05T15:06:02.571832-05:00 malaysia nut-driver@malaysia[61111]: 0.000000#011[D1] debug level is '2'<br>
2023-07-05T15:06:02.572748-05:00 malaysia nut-driver@malaysia[61111]: 0.001186#011[D1] Saving PID 61111 into <br>
/run/nut/upscode2-malaysia.pid<br>
2023-07-05T15:06:02.572795-05:00 malaysia nut-driver@malaysia[61111]: 0.001215#011tcgetattr(/dev/ttyUSB-nut): <br>
Inappropriate ioctl for device<br>
2023-07-05T15:06:02.572818-05:00 malaysia nut-driver@malaysia[61111]: Network UPS Tools - UPScode II UPS driver 0.90 (2.8.0)<br>
2023-07-05T15:06:02.572839-05:00 malaysia nut-driver@malaysia[61111]: Warning: This is an experimental driver.<br>
2023-07-05T15:06:02.572857-05:00 malaysia nut-driver@malaysia[61111]: Some features may not function correctly.<br>
2023-07-05T15:06:02.573030-05:00 malaysia nut-driver@malaysia[61110]: Driver failed to start (exit status=1)<br>
2023-07-05T15:06:02.573066-05:00 malaysia nut-driver@malaysia[61110]: Network UPS Tools - UPS driver controller 2.8.0<br>
2023-07-05T15:06:02.573252-05:00 malaysia systemd[1]: nut-driver@malaysia.service: Control process exited, code=exited, <br>
status=1/FAILURE<br>
2023-07-05T15:06:02.573390-05:00 malaysia systemd[1]: nut-driver@malaysia.service: Failed with result 'exit-code'.<br>
<br>
Not enough time to fail from not finding UPCL<br>
<br>
<br>
This seems like this might be a timing issue - something is running before something else is ready? Debug would slow <br>
something down?<br>
<br>
<br>
I hooked it up to cutecom connected and I seem to get a list of supported commands back if I ask for UPCL<br>
<br>
<br>
UPSS<br>
UPDS<br>
UPDV<br>
UPTP<br>
UPSN<br>
UPPN<br>
UPSD<br>
UPCD<br>
UPPC<br>
UPPU<br>
UPIS<br>
UP??<br>
UPEA<br>
UPDA<br>
UPCL<br>
<br>
Looks like a list of supported commands? UPCL(Ups Command List?)<br>
<br>
<br>
<br>
Takes a couple of seconds.<br>
<br>
<br>
Looking at the debug output of /usr/lib/nut/upscode2 -a malaysia -DDDD<br>
<br>
I see a problem at :<br>
<br>
0.954763 [D3] upscsend: 'UPCD'<br>
0.956318 [D3] upscsend: '0000'<br>
2.958427 [D3] upscrecv: Timeout<br>
4.960535 [D3] upscrecv: Timeout<br>
4.960566 [D2] Got value:<br>
4.960580 Bad response to UPCD 0000:<br>
4.960596 dstate_setflags: base variable (ups.delay.reboot) does not exist<br>
4.960609 dstate_setaux: base variable (ups.delay.reboot) does not exist<br>
<br>
From cutecom - UPCD 0000 returns<br>
<br>
ACCD<br>
060<br>
<br>
<br>
<br>
<br>
<br>
> <br>
> On Wed, Jul 5, 2023, 06:23 Karl Schmidt <<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>>> wrote:<br>
> <br>
> On 7/4/23 10:01PM, Jim Klimov wrote:<br>
> > Normally yes - enable and start the target and the particular services relevant to your setup.<br>
> ><br>
> > For the binary you have from packaging (if not rebuilt as suggested earlier), set debug_min=3 in ups.conf section<br>
> for<br>
> > upscode2, to currently trade driver viability for some storage traffic with more logs :\<br>
> ><br>
> > Sorry about that,<br>
> > Jim<br>
> <br>
> OK - this is strange . If I run it WITH the debug - it works - WITHOUT - it fails. Put debug back in and it works<br>
> again..<br>
> <br>
> With debug I can run upsc malaysia - and it works.. without it fails.<br>
> <br>
> I'm thinking the old 1200 baud is too slow for something?<br>
> <br>
> - The logs are sort of big - should I send to list as attachments or direct?<br>
> <br>
> <br>
> ><br>
> > On Wed, Jul 5, 2023, 02:29 Karl Schmidt <<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a><br>
> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>>>> wrote:<br>
> ><br>
> > Ok - I'm wondering is this is a systemd config bit?<br>
> ><br>
> > systemctl restart nut-driver@malaysia.service<br>
> > Job for nut-driver@malaysia.service failed because the control process exited with error code.<br>
> > See "systemctl status nut-driver@malaysia.service" and "journalctl -xeu nut-driver@malaysia.service" for details.<br>
> > root@malaysia:~# systemctl status nut-driver@malaysia.service<br>
> > ● nut-driver@malaysia.service - Network UPS Tools - device driver for malaysia<br>
> > Loaded: loaded (/lib/systemd/system/nut-driver@.service; enabled; preset: enabled)<br>
> > Drop-In: /etc/systemd/system/nut-driver@malaysia.service.d<br>
> > └─nut-driver-enumerator-generated-checksum.conf<br>
> > Active: activating (auto-restart) (Result: exit-code) since Tue 2023-07-04 19:03:20 CDT; 9s ago<br>
> > Process: 14926 ExecStart=/bin/sh -c NUTDEV="`/usr/libexec/nut-driver-enumerator.sh --get-device-for-service<br>
> > malaysia`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit<br>
> malaysia" >&2 ;<br>
> > exit 1 ; } ; /sbin/upsdrvctl start "$NUTDEV" (code=exited, status=0/SUCCESS)<br>
> > Process: 14955 ExecStop=/bin/sh -c NUTDEV="`/usr/libexec/nut-driver-enumerator.sh --get-device-for-service<br>
> > malaysia`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit<br>
> malaysia" >&2 ;<br>
> > exit 1 ; } ; /sbin/upsdrvctl stop "$NUTDEV" (code=exited, status=1/FAILURE)<br>
> ><br>
> ><br>
> > -------->%-------------------------------------------------<br>
> > So I tried<br>
> > # /usr/libexec/nut-driver-enumerator.sh --get-device-for-service malaysia<br>
> > malaysia<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > I'm not clear about all the unit files -<br>
> ><br>
> > ~# systemctl list-unit-files |grep nut<br>
> > nut-driver-enumerator.path enabled enabled<br>
> > nut-client.service alias -<br>
> > nut-driver-enumerator.service enabled enabled<br>
> > nut-driver@.service indirect enabled<br>
> > nut-monitor.service enabled enabled<br>
> > nut-server.service enabled enabled<br>
> > nut-driver.target enabled enabled<br>
> > nut.target<br>
> ><br>
> > My understanding was to start via nut.target?<br>
> ><br>
> > Checking config directory permissions:<br>
> > # ll |grep nut<br>
> > drwxr-xr-x 2 root nut 4096 2023-07-04 18:46 nut/<br>
> ><br>
> ><br>
> > # ll<br>
> > total 72<br>
> > -rw-r--r-- 1 root root 1076 2023-06-22 00:37 hosts.conf-off<br>
> > -rw-r----- 1 root nut 1921 2023-06-22 00:33 nut.conf<br>
> > -rw-r----- 1 root nut 10065 2023-07-04 18:35 ups.conf<br>
> > -rw-r----- 1 root nut 10068 2023-07-04 18:21 ups.conf~<br>
> > -rw-r----- 1 root nut 7390 2023-06-22 00:35 upsd.conf<br>
> > -rw-r----- 1 root nut 2425 2023-06-22 00:36 upsd.users<br>
> > -rw-r----- 1 root nut 20355 2023-07-04 18:46 upsmon.conf<br>
> > -rw-r----- 1 root nut 4201 2023-01-25 03:27 upssched.conf<br>
> ><br>
> > --<br>
> > --------------------------------------------------------------------------------<br>
> > Karl Schmidt EMail <a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>><br>
> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>>><br>
> > 3209 West 9th Street Ph (785) 841-3089<br>
> > Lawrence, KS 66049<br>
> ><br>
> > The secret of getting ahead is getting started. The secret of<br>
> > getting started is breaking your complex overwhelming tasks into<br>
> > small manageable tasks, and then starting on the first one.<br>
> > --Mark Twain<br>
> > --------------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > Nut-upsuser mailing list<br>
> > <a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a> <mailto:<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a>><br>
> <mailto:<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a> <mailto:<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a>>><br>
> > <a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
> <<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a>><br>
> > <<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
> <<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a>>><br>
> ><br>
> <br>
> -- <br>
> --------------------------------------------------------------------------------<br>
> Karl Schmidt EMail <a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a> <mailto:<a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a>><br>
> 3209 West 9th Street Ph (785) 841-3089<br>
> Lawrence, KS 66049<br>
> <br>
> Beware the fury of a patient man.<br>
> --John Dryden<br>
> --------------------------------------------------------------------------------<br>
> <br>
> _______________________________________________<br>
> Nut-upsuser mailing list<br>
> <a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a> <mailto:<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a>><br>
> <a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
> <<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a>><br>
> <br>
<br>
-- <br>
--------------------------------------------------------------------------------<br>
Karl Schmidt EMail <a href="mailto:karl@lrak.net" target="_blank" rel="noreferrer">karl@lrak.net</a><br>
3209 West 9th Street Ph (785) 841-3089<br>
Lawrence, KS 66049<br>
<br>
Critical mass; it only takes three people to have a party in a closet. -kps<br>
--------------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>