Problem with exec node output in Spawn mode

I'm using the BIGEXEC node, which runs the command: sudo ./rf95_server , but I'm not seeing any output
When I run the command in a raspberry terminal, it displays some messages on the screen every few seconds

An example of running in the terminal with two messages
ricezionedati

node flow
BIGEXEC_NODE

node configuration

message received on startup

The command runs correctly, I don't get any errors
At startup, on the raspberry ,the following startup tasks appear
BIGEXEC_PROCESS

Why am I not getting any messages in the output of the bigexece node?
Do you have any suggestions ?

You may need to contact the author via GitHub. Not sure many people use those nodes who are in the forum?

The debug nodes seem to be configured to output to the console (and perhaps not to the debug window ?)

Is there a reason you are using bigexec rather than the core exec node?

Thanks for the reply @bakman2

The msg node is set for both outputs

Thanks for the reply @Colin
I don't know how to process in node-red the messages generated by the command as shown in the raspberry terminal window, searching the net, I came across the bigexec command ...

Also tried the exec command, as you suggested, but the result doesn't change, I don't get any output message

Flow
image

Node exec configuration
image

When flow is activated, two tasks appear
image

I don't get any error messages or output messages

Your command uses sudo. This will not work because sudo generally requires an extra input on the command line. You would have to edit the sudo permissions to allow the user running Node-RED to issue that command without a password prompt.

Almost certainly, you would be much better allowing the node-red user to access the rf95 software and hardware so that sudo wasn't required.

If you run that command in a terminal, with sudo, does it ask for a password? If so then @TotallyInformation is correct. If it doesn't ask for a password then I guess you have set your pi up (or it was setup like that by default) to not need a pwd when using sudo, which is a security risk. However, if it doesn't ask for a pwd then that is probably not the problem here. In fact, since you see the server in the task list then that is probably not the problem.

Do you see anything in the node red log or in syslog when you start the server?

Thanks for the reply @TotallyInformation

The user Node-Red starts as is the classic pi
I enabled user pi ,in the file /etc/sudoers,
so that it doesn't ask for pwd by entering the line
pi ALL=(ALL:ALL) NOPASSWD:ALL

The fact that the rf95_server line appears in the tasks means that the command has executed it, if it asked for a pwd it would give an error.

If I try to run the command manually without SUDO in the terminal window, it doesn't ask for the pwd , but the error is thrown
paging fault
image

Hi @Colin
The sudo command does not require a password

When I start the exec node in flow , in node-red log it appears

OK, but don't ever let your Pi loose on the Internet or bad things may happen (which they probably would anyway if you are using the pi user) :slight_smile:

I see you are using an extremely ancient version of node-red and a long out of support version of nodejs, so I suggest you start by upgrading to the current version of node-red and node.js v16. On a pi you can usually do that by using the script at Running on Raspberry Pi : Node-RED. However, if you are using an also long out of support version of Pi OS then that may be too old to allow an upgrade.

Thanks for the suggestion, but at the moment it is not reachable from the outside, it remains in my wifi network

You're right @Colin , Node-red is an old version 0.18.4, a bit dated.

This is the version of my Raspberry , do you think it will be supported for the latest version of Node-red ?
image

I think stretch is ok still. I presume you have everything useful backed up anyway.
In future if you could copy/paste text rather than screenshot it would be appreciated.

To tell the script to install nodejs 16 and --node16 on the end.

1 Like

Hello @Colin
I updated Node-Red to version 3.0.2 and with node v16.19.0
and I found the way to run the ./rf95_server program, without using the SUDO command

After these commands, i can run the program, as root user, no matter who started it or from where (no sudo required)

1) sudo chown root rf95_server
2) sudo chmod +s rf95_server

Node exec config
image

after to start
image

task manager
image

From the task manager , it is noted that in this case , unlike the previous ones , the task ./rf95_server is unique , there are no SH or SUDO parent tasks

Even after these updates
the program runs, but I'm not getting any output from the MSG nodes

NOTE : I have the C sources of the program, I can insert a few lines of code and recompile it, if you have any ideas to suggest me

That is dissapointing.

Can you show us what the startup log looks like now please.
Rather than screenshot please copy/paste the text. When pasting use the </> button at the top of the forum entry window to stop the output being interpretted as markdown.

In the C code, what do the lines that output the data look like?
Does it have any command line options to say where to send the output?

Startup log Node-RED

pi@raspberrypi:~ $ node-red-log 
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
14 Feb 22:05:55 - [warn] [node-red-contrib-rfm69radio/rfm69-out] 'rfm69-radio' already registered by module node-red-contrib-rfm69radio
14 Feb 22:05:55 - [warn] [node-red-contrib-rfm69radio/rfm69-radio] 'rfm69-radio' already registered by module node-red-contrib-rfm69radio
14 Feb 22:05:55 - [warn] ------------------------------------------------------
14 Feb 22:05:55 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Feb 22:05:55 - [info] Context store  : 'default' [module=memory]
14 Feb 22:05:55 - [info] User directory : /home/pi/.node-red
14 Feb 22:05:55 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
14 Feb 22:05:55 - [warn] Flows file name not set. Generating name using hostname.
14 Feb 22:05:55 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
14 Feb 22:05:55 - [info] Server now running at http://127.0.0.1:1880/
14 Feb 22:05:55 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
14 Feb 22:05:55 - [info] Starting flows
14 Feb 22:05:55 - [info] Started flows

When I run the exec node, no message appears in the log

Part of the C code that writes the outgoing message with printf command

         if (rf95.available()) { 
#ifdef RF_LED_PIN
          led_blink = millis();
          digitalWrite(RF_LED_PIN, HIGH);
#endif
          // Should be a message for us now
          uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
          uint8_t len  = sizeof(buf);
          uint8_t from = rf95.headerFrom();
          uint8_t to   = rf95.headerTo();
          uint8_t id   = rf95.headerId();
          uint8_t flags= rf95.headerFlags();;
          int8_t rssi  = rf95.lastRssi();
          
          if (rf95.recv(buf, &len)) {
            printf("Packet[%02d] #%d => #%d %ddB: ", len, from, to, rssi);
            printbuffer(buf, len);
          } else {
            Serial.print("receive failed");
          }
          printf("\n");
        }

printf should go to stdout, so that doesn't provide any clues.

You haven't got the start of the log. Run
node-red-stop
node-red-start
and it should give it you from the start.

That is not good. That suggests that you have two nodes installed for doing a similar thing.

If you don't think that is the case please post the file package.json

[Edit] Actually it looks like this is a fault in the node, see 9 Nodes, "already registered", disconnected · Issue #4 · AndyFlem/rfm69radio-node · GitHub
The fact that it has multiple unaddressed issues over several years suggests that the node is not supported, so you may be out of luck getting it to work.