Can't start node-red 4 after re-install on pi zero w

Hi

I'm trying to run node-red on a headless pi zero w with a fresh OS install. This all worked previously with an earlier pi OS and version 3.x of node-red - until my ssd died. I've tried to reinstall and get it working but with little success.

I'm aware that due to the arm6 hardware of the pi zero, I have to use unofficial node builds as described here:
https://github.com/sdesalas/node-pi-zero

I copied a script and changed the version to 20.15.0 - which I thought was the latest version - and node seems to have installed correctly.

Running "node -v" I get:
v20.15.0

My OS version is:
Operating System: Raspbian GNU/Linux 12 (bookworm)
Kernel: Linux 6.6.31+rpt-rpi-v6
Architecture: arm

I installed nodered using:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Y to continue
N for additional pi nodes

Trying to start the service (node-red-start) it couldn't find the start / stop scripts so I added the following to .bashrc:
PATH=/opt/nodejs/bin/:${PATH}

I could then run the start script but it failed with an error:
/usr/bin/env: 'node-red-pi': No such file or directory
I added the following symlink as described here:
https://github.com/HaroldPetersInskipp/Raspberry-Pi-Scripts
sudo ln -s /opt/nodejs/lib/node_modules/node-red/bin/node-red-pi /usr/bin/node-red-pi

Now, running node-red-start, it fails with the following:

Starting as a systemd service.
nodered.service: Main process exited, code=killed, status=4/ILL
nodered.service: Failed with result 'signal'.
nodered.service: Consumed 4.746s CPU time.
nodered.service: Scheduled restart job, restart counter is at 1.
Stopped nodered.service - Node-RED graphical event wiring tool.
nodered.service: Consumed 4.746s CPU time.
Started nodered.service - Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=killed, status=4/ILL
nodered.service: Failed with result 'signal'.
nodered.service: Consumed 4.783s CPU time.
nodered.service: Scheduled restart job, restart counter is at 2.
Stopped nodered.service - Node-RED graphical event wiring tool.
nodered.service: Consumed 4.783s CPU time.
...

If I edit the script "/opt/nodejs/lib/node_modules/node-red/bin/node-red-pi", and put some debug in to dump $OPTIONS, $ARGS and $0, and then run it using:
node-red-pi --max-old-space-size=128 -v

I get the following:
OPTIONS: --max-old-space-size=128
ARGS: -v
0: /usr/bin/node-red-pi
< ... a delay of about 5 seconds ... >
Illegal instruction

The script is obviously being called with my args, but it is then exiting with "Illegal instruction" after a delay of about 5 seconds.

If I rerun the installer, the log contains the line "Package 'nodered' is not installed, so not removed" - which seems a little strange as I had previously run the node-red installer as above.

I also notice in the forum there is what seems to be a similar post: 🎉 Node-RED 4.0 released - #20 by FireWizard52

I suspect that my installation of node-red didn't complete correctly and I'm still missing some symlinks, environment config or permissions.

I'm struggling to move forward with this and any help would be very much appreciated.

Thanks

Dave

I fear that by manually installing stuff to non standard locations you may have made things worse. The script would have installed nodejs for you.

What do you see if you run
node-red

Currently I think you need to stick with nodejs 18

@blooders rerun the script with --node18 on the end, after a space.

Hi, I understand but I have to install node myself in order to get the "Unofficial build". The official builds do not support [the pi zero] arm6 hardware and so I cannot rely on the node-red script to handle the node install.

As I say, this procedure worked previously with node-red 3.x.

Running node-red I get a delay of a few seconds and then I see "Illegal instruction" as before.

Thanks

The script will install the unofficial build for you. Nodejs 20 does not work.

1 Like

I'll try with node18. Although it'll be tomorrow at the earliest - I have to look at something else :frowning:

Thanks both for your input.

Hi, I completely removed npm, and node, and re-ran the install with the --node18 switch.

node -v reports: v18.20.3
npm -v reports: 10.7.0

Trying to start from the service gives the same error as before:

nodered.service: Main process exited, code=killed, status=4/ILL
nodered.service: Failed with result 'signal'.
nodered.service: Consumed 5.110s CPU time.

Runing node-red still gives:

Illegal instruction

If you think that I may have already compromised this environment then I'm happy to try wiping the whole thing and starting again from scratch.

Thanks

Okay, so I uninstalled node-red and re-ran the installer with switches --node18 and --nodered-version="3.1"

The service now starts without a problem:

Starting as a systemd service.
6 Jul 19:24:08 - [info]
Welcome to Node-RED
===================
6 Jul 19:24:08 - [info] Node-RED version: v3.1.11
6 Jul 19:24:08 - [info] Node.js  version: v18.20.3
6 Jul 19:24:08 - [info] Linux 6.6.31+rpt-rpi-v6 arm LE
6 Jul 19:24:12 - [info] Loading palette nodes
6 Jul 19:24:25 - [info] Settings file  : /home/pi/.node-red/settings.js
6 Jul 19:24:25 - [info] Context store  : 'default' [module=memory]
6 Jul 19:24:25 - [info] User directory : /home/pi/.node-red
6 Jul 19:24:25 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 Jul 19:24:25 - [info] Flows file     : /home/pi/.node-red/flows.json
6 Jul 19:24:25 - [info] Creating new flow file
6 Jul 19:24:25 - [warn] Using unencrypted credentials
6 Jul 19:24:26 - [info] Server now running at http://127.0.0.1:1880/
6 Jul 19:24:26 - [info] Starting flows
6 Jul 19:24:26 - [info] Started flows

You should be able to upgrade node red
sudo npm install -g --unsafe-perm node-red

After several tests I made the conclusion that

  1. NodeJS v18 is the latest version, that will run under Rasberry Pi OS "Buster".
    This is, because of the GLIBC version, that does not support NodeJS v20.
  2. Probably NodeJS v20 will run in Rasberry Pi OS "Bullseye" or "Bookworm" (Not tested).
  3. Node-RED v4.x.x will not run on a Raspberry Pi with armV6 architecture.
    So it will not work on a Pi 1 or Pi Zero.

Currently Node-RED version 3.1.11 is the latest v3 version.
You can install it as follows:

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --nodered-version="3.1.11"

This version runs fine on a Pi1 with Rasberry Pi OS "Buster".

So, what you have installed now is the correct version (3.1.11) and is also the latest possible version on a Pi Zero with armV6 architecture.

Hi

I must admit that I came to a similar conclusion after trying various version combinations. I'm going to leave this environment at 3.1.11.

Thanks all for your input.

Are you saying nr4 with nodejs 18 does not work on that hardware?

I could not get Node-red v4to work on an armv6 Pi (a Pi 1a) regardless of the Nodejs and RPiOS versions.

Although it does work with 3.1.11 and nodejs v18 on Buster, since the release of NR 4, I think the old single core Raspberry Pies should be considered unsupported by Node-red

@Colin,

Yes, I tested both 4.0.0 and 4.0.1 on a RPi 1B and got always the same error. This is confirmed by @blooders post above.

`Failed with result 'signal'`

I do not expect that it is get fixed, as RPi1 and RPi Zero are outdated, but if someone get it fixed, I will be happy to test.

Going back through the combinations I've tested, nodejs 18 and 20 both work on the pi zero (bookworm) with node-red 3.1.11, but node-red 4.0.2 doesn't work with either version. It always fails with the same [log] symptoms.

1 Like

@dceejay does that make any sense to you?

I had the same error on Pi Zero W today.

node-red.service: Failed with result 'signal'

I thought the OS must have been corrupted, so I freshly installed again using the Pi imager and got exactly the same.

I tried using the --nodered-version="3.1" and it worked :slight_smile:

Anders

Here is a script to install the experimental version of Node that supports the ARM6 architecture. GitHub - sdesalas/node-pi-zero: Node installation on the Raspberry Pi Zero (Including v12+ Experimental Builds)

But I still have problems

From my other thread...

First issue that I ran into was that Node js has been deprecated on the ARM6 Pi-Zero architecture.

I found this post about installing the 'experimental' versions.

Now when I run the node-red installer it seems to run but I do not end up with a node-red or a node-red-pi executable in my /usr/bin directory.

ls /usr/bin/node*
/usr/bin/node          /usr/bin/node-red-reload   /usr/bin/node-red-start
/usr/bin/node-red-log  /usr/bin/node-red-restart  /usr/bin/node-red-stop

There were no ominous warnings in the log file and the only visual from the installer was the final two lines of output

Running Node-RED install for user me at /home/me on raspbian


This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Node option not specified           :   --node18 or --node20
  Leave existing Node.js              :   v20.11.1   Npm 10.2.4
  Clean npm cache                     -
  Install Node-RED core               ✔   4.0.2
  Move global nodes to local          -
  Leave existing nodes                -
  Install extra Pi nodes              ✔
  Add shortcut commands               ✔
  Update systemd script               ✔


Any errors will be logged to   /var/log/nodered-install.log
All done.
You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started :  Mon  8 Jul 09:36:43 EDT 2024
Finished:  Mon  8 Jul 09:48:40 EDT 2024

**********************************************************************************
 ### WARNING ###
 DO NOT EXPOSE NODE-RED TO THE OPEN INTERNET WITHOUT SECURING IT FIRST

 Even if your Node-RED doesn't have anything valuable, (automated) attacks will
 happen and could provide a foothold in your local network

 Follow the guide at https://nodered.org/docs/user-guide/runtime/securing-node-red
 to setup security.

 ### ADDITIONAL RECOMMENDATIONS ###
  - Remove the /etc/sudoers.d/010_pi-nopasswd file to require entering your password
    when performing any sudo/root commands:

      sudo rm -f /etc/sudoers.d/010_pi-nopasswd

  - You can customise the initial settings by running:

      node-red admin init

  - After running Node-RED for the first time, change the ownership of the settings
    file to 'root' to prevent unauthorised changes:

      sudo chown root:root ~/.node-red/settings.js

**********************************************************************************

sudo: /usr/bin/node-red: command not found
chown: cannot access '/home/me/.node-red/settings.js': No such file or directory
 ls -la .node-red
total 32
drwxr-xr-x  3 me me 4096 Jul  8 09:43 .
drwx------  6 me me 4096 Jul  8 09:42 ..
drwxr-xr-x 16 me me 4096 Jul  8 09:43 node_modules
-rw-r--r--  1 me me 448 Jul  8 09:43 package.json
-rw-r--r--  1 me me 13066 Jul  8 09:43 package-lock.json

We're working on a workaround as we speak. Ben has identified the main issue causing the "illegal instruction" error.
Hopefully the install script now fixes it...