Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

@MichaIng
I'm able to replicate the issue on my RPi1.

Looks like somewhere around installation of RPI-GPIO v1.2.3. (via web interface) quite some files are vanished from file system. This lead node to fail

Code: Select all

root@DietPi1:/mnt/dietpi_userdata/node-red# systemctl status node-red
● node-red.service - Node-RED (DietPi)
   Loaded: loaded (/etc/systemd/system/node-red.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2021-05-02 15:40:31 CEST; 6s ago
  Process: 628 ExecStart=/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red -u /mnt/dietpi_userdata/node-red (code=exited, status=203/EXEC
)
 Main PID: 628 (code=exited, status=203/EXEC)

May 02 15:40:31 DietPi1 systemd[1]: Started Node-RED (DietPi).
May 02 15:40:31 DietPi1 systemd[628]: node-red.service: Failed to execute command: No such file or directory
May 02 15:40:31 DietPi1 systemd[628]: node-red.service: Failed at step EXEC spawning /mnt/dietpi_userdata/node-red/node_modules/
.bin/node-red: No such file or directory
May 02 15:40:31 DietPi1 systemd[1]: node-red.service: Main process exited, code=exited, status=203/EXEC
May 02 15:40:31 DietPi1 systemd[1]: node-red.service: Failed with result 'exit-code'.
root@DietPi1:/mnt/dietpi_userdata/node-red#
/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red disappreraed :?

This is the issue for RPI-GPIO installation

Code: Select all

May 02 15:34:25 DietPi1 node-red[570]: 2 May 15:34:25 - [info] Starting flows
May 02 15:34:25 DietPi1 node-red[570]: 2 May 15:34:25 - [info] Started flows
May 02 15:34:25 DietPi1 node-red[570]: 2 May 15:34:25 - [info] Server now running at http://127.0.0.1:1880/
May 02 15:35:45 DietPi1 node-red[570]: 2 May 15:35:45 - [info] Installing module: node-red-node-pi-gpio, version: 1.2.3
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [info] Installed module: node-red-node-pi-gpio
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [warn] Installation of module node-red-node-pi-gpio failed:
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [warn] ------------------------------------------
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [warn] undefined
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [warn] ------------------------------------------
May 02 15:37:36 DietPi1 node-red[570]: Error: Install failed
May 02 15:37:36 DietPi1 node-red[570]:     at exec.run.then.catch.result (/mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/installer.js
:214:23)
May 02 15:37:36 DietPi1 node-red[570]:     at processTicksAndRejections (internal/process/task_queues.js:86:5)
May 02 15:37:36 DietPi1 node-red[570]: 2 May 15:37:36 - [error] Error: Install failed

On the other side, running

Code: Select all

sudo -u nodered npm up node-red
right after a plain install, did not do any harm to the system.

I need to run further test. Unfortunetly the RPi1 is quite slow and quite long running to reset and reinstall :roll:

@torwan
I could fix the system running dietpi-software reinstall 122. This restored Node-Red for me as well as RPI-GPIO was installed afterwards.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Many thanks for testing again :)!

Hmm, when installing the module via web interface (palette manager), did the green popup appear that it went well?
And journalctl -u node-red doesn't show an error either (before restart attempt)?

It removes the Node-RED core module, it seems. Probably in the architecture + Node version, the Node-RED core module is not compatible with the RPi.GPIO module, so that installing the letter one automatically removes the first, or it downgrades Node-RED core, breaking itself (the web interface) so that it does not install the lower version anymore. The only idea I have at least. To verify this, one could do a clean install, then:

Code: Select all

cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm i node-red-node-pi-gpio
So the install over the local Node-RED core can be followed, including any possible dependency issues.

If the idea is true, then we should check back with Node-RED devs, whether it is possible to abort module installs/upgrades from the web interface in the first place, instead of having other modules purged or downgraded without any user information and confirmation about that. When Node-RED core is a system module, the web interface had no permissions to change it, but if other modules are potentially removed or downgraded, this is still an issue that should be addressed.
torwan
Posts: 9
Joined: Mon Apr 26, 2021 7:57 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by torwan »

MichaIng wrote: Sun May 02, 2021 4:39 pm Many thanks for testing again :)!

Hmm, when installing the module via web interface (palette manager), did the green popup appear that it went well?
And journalctl -u node-red doesn't show an error either (before restart attempt)?

It removes the Node-RED core module, it seems. Probably in the architecture + Node version, the Node-RED core module is not compatible with the RPi.GPIO module, so that installing the letter one automatically removes the first, or it downgrades Node-RED core, breaking itself (the web interface) so that it does not install the lower version anymore. The only idea I have at least. To verify this, one could do a clean install, then:

Code: Select all

cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm i node-red-node-pi-gpio
So the install over the local Node-RED core can be followed, including any possible dependency issues.

If the idea is true, then we should check back with Node-RED devs, whether it is possible to abort module installs/upgrades from the web interface in the first place, instead of having other modules purged or downgraded without any user information and confirmation about that. When Node-RED core is a system module, the web interface had no permissions to change it, but if other modules are potentially removed or downgraded, this is still an issue that should be addressed.
I have a spare SD under hand so I made a clean install again. Before I read the above message I installed Node-Red with use of DietPi Optimized Software wizard.

In Node-Red web interface, triggered installation of RPI-GPIO v1.2.3 throws after some time a pop-up with:

Code: Select all

Failed to install: node-red-node-pi-gpio
Install failed
Check the log for more information
There are two buttons: Close and View log. The view log shows:
-----------------------------------------------------------
2021-05-02T19:20:17.586Z Install : node-red-node-pi-gpio 1.2.3

2021-05-02T19:20:17.111Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-node-pi-gpio@1.2.3
2021-05-02T19:21:35.404Z [out] + node-red-node-pi-gpio@1.2.3
2021-05-02T19:21:35.404Z [out] added 1 package from 1 contributor and removed 302 packages in 68.346s
2021-05-02T19:21:35.494Z rc=0
BTW installed Node-Red version is 1.3.4.

Running the followg:

Code: Select all

root@DietPi:~# journalctl -u node-red
...prints this:

Code: Select all

root@DietPi:~# journalctl -u node-red
-- Logs begin at Thu 2021-03-25 20:59:27 CET, end at Sun 2021-05-02 21:21:35 CEST. --
May 02 21:16:39 DietPi systemd[1]: Started Node-RED (DietPi).
May 02 21:16:50 DietPi node-red[3503]: 2 May 21:16:50 - [info]
May 02 21:16:50 DietPi node-red[3503]: Welcome to Node-RED
May 02 21:16:50 DietPi node-red[3503]: ===================
May 02 21:16:50 DietPi node-red[3503]: 2 May 21:16:50 - [info] Node-RED version: v1.3.4
May 02 21:16:50 DietPi node-red[3503]: 2 May 21:16:50 - [info] Node.js  version: v11.15.0
May 02 21:16:50 DietPi node-red[3503]: 2 May 21:16:50 - [info] Linux 5.10.17+ arm LE
May 02 21:16:54 DietPi node-red[3503]: 2 May 21:16:54 - [info] Loading palette nodes
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [info] Settings file  : /mnt/dietpi_userdata/node-red/settings.js
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [info] Context store  : 'default' [module=memory]
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [info] User directory : /mnt/dietpi_userdata/node-red
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [info] Flows file     : /mnt/dietpi_userdata/node-red/flows_DietPi.json
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [info] Creating new flow file
May 02 21:17:04 DietPi node-red[3503]: 2 May 21:17:04 - [warn]
May 02 21:17:04 DietPi node-red[3503]: ---------------------------------------------------------------------
May 02 21:17:04 DietPi node-red[3503]: Your flow credentials file is encrypted using a system-generated key.
May 02 21:17:04 DietPi node-red[3503]: If the system-generated key is lost for any reason, your credentials
May 02 21:17:04 DietPi node-red[3503]: file will not be recoverable, you will have to delete it and re-enter
May 02 21:17:04 DietPi node-red[3503]: your credentials.
May 02 21:17:04 DietPi node-red[3503]: You should set your own key using the 'credentialSecret' option in
May 02 21:17:04 DietPi node-red[3503]: your settings file. Node-RED will then re-encrypt your credentials
May 02 21:17:04 DietPi node-red[3503]: file using your chosen key the next time you deploy a change.
May 02 21:17:04 DietPi node-red[3503]: ---------------------------------------------------------------------
May 02 21:17:05 DietPi node-red[3503]: 2 May 21:17:05 - [info] Server now running at http://127.0.0.1:1880/
May 02 21:17:05 DietPi node-red[3503]: 2 May 21:17:05 - [info] Starting flows
May 02 21:17:05 DietPi node-red[3503]: 2 May 21:17:05 - [info] Started flows
May 02 21:20:17 DietPi node-red[3503]: 2 May 21:20:17 - [info] Installing module: node-red-node-pi-gpio, version: 1.2.3
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [info] Installed module: node-red-node-pi-gpio
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [warn] Installation of module node-red-node-pi-gpio failed:
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [warn] ------------------------------------------
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [warn] undefined
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [warn] ------------------------------------------
May 02 21:21:35 DietPi node-red[3503]: Error: Install failed
May 02 21:21:35 DietPi node-red[3503]:     at exec.run.then.catch.result (/mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/installer.js:214:23)
May 02 21:21:35 DietPi node-red[3503]:     at processTicksAndRejections (internal/process/task_queues.js:86:5)
May 02 21:21:35 DietPi node-red[3503]: 2 May 21:21:35 - [error] Error: Install failed
Running this:

Code: Select all

cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm i node-red-node-pi-gpio
...prints this:

Code: Select all

root@DietPi:~# cd /mnt/dietpi_userdata/node-red
root@DietPi:/mnt/dietpi_userdata/node-red# sudo -u nodered npm i node-red-node-pi-gpio
+ node-red-node-pi-gpio@1.2.3
updated 1 package and audited 1 package in 5.588s
found 0 vulnerabilities

root@DietPi:/mnt/dietpi_userdata/node-red#
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

@MichaIng

Something wrong on the package installation

Code: Select all

root@DietPi1:/mnt/dietpi_userdata/node-red# sudo -u nodered npm i node-red-node-pi-gpio
+ node-red-node-pi-gpio@1.2.3
added 1 package from 1 contributor, removed 302 packages and audited 1 package in 104.427s
found 0 vulnerabilities
removed 302 packages vs added 1 package WTF :x

/mnt/dietpi_userdata/node-red/node_modules/.bin if nearly empty

Code: Select all

root@DietPi1:/mnt/dietpi_userdata/node-red/node_modules/.bin# ls -la
total 16
drwxr-xr-x 2 nodered nodered  4096 May  2 21:53 .
drwxr-xr-x 5 nodered nodered 12288 May  2 21:54 ..
lrwxrwxrwx 1 nodered nodered    33 May  2 17:07 detect-libc -> ../detect-libc/bin/detect-libc.js
lrwxrwxrwx 1 nodered nodered    20 May  2 17:07 needle -> ../needle/bin/needle
lrwxrwxrwx 1 nodered nodered    32 May  2 17:07 node-pre-gyp -> ../node-pre-gyp/bin/node-pre-gyp
lrwxrwxrwx 1 nodered nodered    12 May  2 17:07 rc -> ../rc/cli.js
lrwxrwxrwx 1 nodered nodered    16 May  2 17:07 rimraf -> ../rimraf/bin.js
root@DietPi1:/mnt/dietpi_userdata/node-red/node_modules/.bin#
now for sure Node-Red is not starting anymore.

Code: Select all

May 02 21:58:34 DietPi1 systemd[1]: Started Node-RED (DietPi).
May 02 21:58:34 DietPi1 systemd[2525]: node-red.service: Failed to execute command: No such file or directory
May 02 21:58:34 DietPi1 systemd[2525]: node-red.service: Failed at step EXEC spawning /mnt/dietpi_userdata/node-red/node_modules/.bin/node-red: No such file or directory
May 02 21:58:34 DietPi1 systemd[1]: node-red.service: Main process exited, code=exited, status=203/EXEC
May 02 21:58:34 DietPi1 systemd[1]: node-red.service: Failed with result 'exit-code'.
however dietpi-software reinstall 122 fix it as it will install the require modules again

node-red-node-pi-gpio is showen as installed now

picture.png
picture.png (12.54 KiB) Viewed 241 times
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
torwan
Posts: 9
Joined: Mon Apr 26, 2021 7:57 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by torwan »

Joulinar wrote: Sun May 02, 2021 4:24 pm @torwan
I could fix the system running dietpi-software reinstall 122. This restored Node-Red for me as well as RPI-GPIO was installed afterwards.
I can confirm, same on my side.

So, I do not know what is really the root cause but I hope all above will help to fix it in the next DietPi distribution.
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

On my VM it works fine:

Code: Select all

# sudo -u nodered npm i node-red-node-pi-gpio

added 1 package, and audited 364 packages in 4s

7 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 7.10.0 -> 7.11.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.11.2
npm notice Run npm install -g npm@7.11.2 to update!
npm notice
The module is added to package.json as expected:

Code: Select all

# cat package.json
{
  "dependencies": {
    "node-red": "^1.3.4",
    "node-red-node-pi-gpio": "^1.2.3"
  }
}
And to dependencies via package-lock.json.

Testing on ARMv7 RPi...
... Raspbian seems to do some mirror update currently, getting "File has unexpected size" errors currently. Will check later, in case tomorrow.
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

or could it be ARMv6?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Now I remember one important difference on ARMv6: https://nodejs.org/dist/
Node v11 was the last version, where ARMv6 binaries are available. Starting with v12, they skip it. This is the reason why we needed to fork the Node installer we use: https://github.com/taaem/nodejs-linux-i ... r/issues/9

And now I checked again the Node-RED installer, which pulls Node v12 from an unofficial source: https://unofficial-builds.nodejs.org/download/release/
This provides even Node v15 for ARMv6.

And by coincidence, now I see there is a PR on my Node installer fork to add support for this source: https://github.com/MichaIng/nodejs-linu ... ler/pull/2
Seems like we have a solution to test. I'll have a closer look at the PR tomorrow.
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

let me know once you are ready and I will check it on my RPi1
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

PR ready: https://github.com/MichaIng/DietPi/pull/4345

I cannot verify whether it fixes the issue with Node v11.15.0 on ARMv6, since with that version on my systems even fresh bare Node-RED does not work, so it seems to cause more fundamental issues there, including a bunch of warning during compilation :?.
Post Reply