[Nut-upsuser] failed after upgrade - upscode2: Missing UPCL after UPCL

Jim Klimov jimklimov+nut at gmail.com
Wed Jul 5 22:02:18 BST 2023


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.

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.

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...

Jim

On Wed, Jul 5, 2023, 22:49 Karl Schmidt <karl at lrak.net> wrote:

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


More information about the Nut-upsuser mailing list