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.
torwan
Posts: 9
Joined: Mon Apr 26, 2021 7:57 pm

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

Post by torwan »

Hi,

- DietPi_RPi-ARMv6-Buster.7z downloaded April 21st, 2021
- Raspberry Pi Zero W v1.1

Try to boot from above image, then install Node-Red with use of the DietPi optimized software installation system. It works fine by this moment, you can deploy a flow etc, all is good.

Then try to update your new Node-Red according to the update instruction from:
https://dietpi.com/docs/software/hardwa ... /#node-red

I mean these simple commands...
systemctl stop node-red
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm up node-red
systemctl start node-red

Above update will crash your Node-Red completely. You will nod be able to run it again. DietPi team, please!

Another experiment. Try to install RPI-GPIO 1.2.3 or something else from inside the Node-Red. It will fail. DietPi team, please! Why to add Node-Red for RPi when RpI IO lib cannot be added!

Try to uninstall the Node-Red and install it manually using the script from Node-Red webpage. It will fail telling you that DietPi system is recognized and you should use embedded optimized software installation system. Vicious circle.

I got fed up with this whole DietPi experiment and installed Raspberry Pi OS Lite. Everything works like a charm, straight away.
User avatar
MichaIng
Site Admin
Posts: 2924
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 your report. Some details would have been great to enable us identifying and fixing the issue.

I tested the current local install method and as well a global install (npm i -g node-red) and in both cases indeed the web UI stays blank aside of the header bar, with the following browser error:

Code: Select all

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
    at Object.init (http://192.168.1.22:1880/red/red.min.js:16:17142)
    at Object.init (http://192.168.1.22:1880/red/red.min.js:16:16449)
    at HTMLDocument.<anonymous> (http://192.168.1.22:1880/red/main.min.js:16:161)
    at e (http://192.168.1.22:1880/vendor/vendor.js:2:30005)
    at t (http://192.168.1.22:1880/vendor/vendor.js:2:30307)
That is new. Either a recent Node-RED update or Node.js update broke it. Does it match the issue you faced after updating Node-RED or what do you mean by "crash your Node-Red completely" and "will nod be able to run it again"?

EDIT: Nope, the above error was due to some Cookie overlap with other test applications on that server. The browser denies to access the local/cookie storage then. Issue solved. Also I can now upgrade and downgrade with the commands from the docs without breaking anything. So again it would be helpful to know what the exact error/failure is you faced.

The official installer btw installs Node v12 and installs it as global module (like we did prior to DietPi v6.34), otherwise it's pretty much the same.

About the RPi GPIO, you mean that module? https://www.npmjs.com/package/rpi-gpio
v1.2.3 does not support any Node version above v8, while we install v16. So you'd need to use the recent version v2.1.7. Also what you mean by "It will fail"? Is there any error message included?

I'll play with older Node-RED and Node.js versions to see which combination works.
User avatar
MichaIng
Site Admin
Posts: 2924
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 found from the palette: node-red-node-pi-gpio v1.2.3 which is obviously what you meant.

Install worked flawlessly:

Code: Select all

Nodes zur Palette hinzugefügt:

rpi-gpio in
rpi-gpio out
rpi-mouse
rpi-keyboard
The new nodes appear at the bottom of the list and I can add and manage them. So apparently in your case something failed that is not a general issue with the install method but dedicated to the system stage or so. But without logs or details I have no chance to investigate :(.

I'll do another test on RPi.

EDIT: Also on RPi it all works fine. Unable to replicate any issues.
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 »

Thanks for your trials. Have you tried with RPi Zero W? Maybe this is where the issue is.

I switched to Raspberry Pi OS Lite and did not experience any of the described by me issues with DietPi and Node-Red.

Have you tried to work with Node-Red installed by the DietPi embedded software installation system? If not, please try it and then from Node-Red try to install node-red-node-pi-gpio v1.2.3 from the "Manage palette". In my case it was failing. My steps were as follows:
1. Flash SD with DietPi_RPi-ARMv6-Buster.7z downloaded April 21st, 2021
2. Boot Raspberry Pi Zero W v1.1 with the prepared SD.
3. Install Node-Red via DietPi-software and "Software Optimized"
4. Access Node-Red flow creator via web broswer.
5. Try to install node-red-node-pi-gpio v1.2.3 from the "Manage palette".
6. I was getting install error notification.

I do not have details for the displayed error and for other things as when I tried to create an account to post this issue here your account creator was not working, throwing some crazy message saying that "some action cannot be performed" or something similar. I got back to operation day later so I created an accound and posted. Earlier I was too pissed on DietPi. OS was not working as expected and then it was impossible to create an account to post here about the issues.

BTW for installation of Node-Red I tried to use the following script:

Code: Select all

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
from:
https://nodered.org/docs/getting-started/raspberrypi
User avatar
MichaIng
Site Admin
Posts: 2924
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

It did exactly those steps, which worked fine on multiple systems. We'd need to check the exact error message and in case Node-RED debug logs to be able to further investigate.

Probably it was simply some filesystem error.
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: Wed Apr 28, 2021 10:33 pm It did exactly those steps, which worked fine on multiple systems. We'd need to check the exact error message and in case Node-RED debug logs to be able to further investigate.

Probably it was simply some filesystem error.
I went today through the listed steps at my Raspberry Pi 2B+ and installation of RPI-GPIO 1.2.3. lib from inside Node-Red works fine. I used exactly the same image as before for RPi Zero W. So there must be something wrong with DietPi driving RPi Zero W. When I was playing with my Zero W I actually installed the OS two times to check if this was me who crashed something on the way or something wrong with the OS working with specific HW platform and it seems DietPi is not well tested on RasPi Zero W.
User avatar
Joulinar
Posts: 4536
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

Hi,

just to avoid a misunderstanding. DietPi is not an own OS. In case of RPi devices, Raspberry OS is used as base image. Means, DietPi is a Raspberry OS with reduced amount of packages and some scripting on top. As well RPi Zero W is, behind RPi3 and 4, one of the most popular model. More than 7% of our users using such a SBC. (according survey statistics)
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: 2924
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

Indeed, DietPi is very well tested on RPi Zero and the benefit of using the official Raspberry Pi OS distro and kernel is that it is cross-compatible across all DietPi models and tested with the official Raspberry Pi OS. From the CPU/architecture perspective, RPi Zero = RPi 1 = ARMv6 hard-float, so its very unlikely that there are any differences between Node-RED running on the one or on the other. I more suspect an issue with disk writes, possible RAM shortage, CPU temperature or voltage issues. The RPi Zero is clearly more prune to such things as it runs the same SoC on higher clock rates by default.

The other thing is the difference between the Node-RED installer script, which is very old, using an outdated Node version etc and installs Node-RED as global system module instead of local one, which breaks the ability to update or uninstall core modules without implying security downsides. The principal method of doing a local install has been tested intensively and is unlikely affected at all by the SBC/SoC/architecture, but for completeness it needs to be mentioned.

If we want to debug this, we need the exact error message and service + system logs, as we are not able to replicate it following the above steps. The thread is here, so hopefully other users find it if having similar issues.
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: Fri Apr 30, 2021 2:27 pm Indeed, DietPi is very well tested on RPi Zero and the benefit of using the official Raspberry Pi OS distro and kernel is that it is cross-compatible across all DietPi models and tested with the official Raspberry Pi OS. From the CPU/architecture perspective, RPi Zero = RPi 1 = ARMv6 hard-float, so its very unlikely that there are any differences between Node-RED running on the one or on the other. I more suspect an issue with disk writes, possible RAM shortage, CPU temperature or voltage issues. The RPi Zero is clearly more prune to such things as it runs the same SoC on higher clock rates by default.

The other thing is the difference between the Node-RED installer script, which is very old, using an outdated Node version etc and installs Node-RED as global system module instead of local one, which breaks the ability to update or uninstall core modules without implying security downsides. The principal method of doing a local install has been tested intensively and is unlikely affected at all by the SBC/SoC/architecture, but for completeness it needs to be mentioned.

If we want to debug this, we need the exact error message and service + system logs, as we are not able to replicate it following the above steps. The thread is here, so hopefully other users find it if having similar issues.
I will repeat, I used the same Raspberry Pi Zero W v1.1 with exactly the same SD card.
I run three experiments:
1. DietPi
2. DietPi (again flashed the same SD with the same image)
3. Raspberry Pi OS Lite

In 1 & 2 I installed Node-Red with use of Optimized Software DietPi installer and the installed Node-Red does not allow to install any additional libraries (installation triggered from inside Node-Red with use of embedded libs manager), eg. ...RPI-GPIO v1.2.3. I then tried to run Node-Red update according to DietPi webpage using these instructions:

Code: Select all

systemctl stop node-red
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm up node-red
systemctl start node-red
Above instructions crashed the Node-Red which could not be started anymore (same in experiment 1 & 2).

Then I uninstalled the Node-Red with use of DietPi Optimised Software Uninstaller and tried to installer it with use of this well known and popular script:

Code: Select all

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
It was not possibe, as the script says that DietPi is recognized and that I should use DietPi Optimised Software installer to install Node-Red.

I gave up after above. I stepted into experiment 3:
I flashed the same SD card with RaspberryPi OS Lite and inserted the SD into the same Raspberry Pi Zero v1.1.
Then I run the script:

Code: Select all

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Node-Red was working straight of the box, RPI-GPIO v.1.2.3 was installed automatically by the script and I could easily install other libs from inside the Node-Red.

Above tells me that DietPi Optimised Software installed does something wrong. So you can keep repeating that DietPi is a sort of RaspberryPi distro port and that it's well tested but I can see on my own eyes is that your Optimised Software installer does something wrong and it would be worth repairing it. And this was definitely not well tested.

BTW I really appreciate the fact that you are very communicative on this forum and that you try to understand where the issue is. Thanks for that! Good standards!
User avatar
MichaIng
Site Admin
Posts: 2924
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

I understood and have no doubt that something went wrong in your case. The issue still is that we do not see an obvious bug, cannot replicate the issue and have no logs to start any debugging with. It's good that we (including you) collected all information here that helps with debugging, if anyone else is facing that issue and I'm happy that you have a functional Node-RED instance now.

Btw, if anyone wants to use the curl installer on DietPi, ping me here and we'll remove the DietPi exit path from the installer, to allow further debugging.
Post Reply