Moving SD card from Pi3 to PiZero

I did all my development on a Pi3 and then stuck the card into a PiZero and got this

pi@kitchencheer2:~/.node-red $ node-red
Illegal instruction

and then remembered you couldn't just do that as it needs sorting out to run on the older ARM chip in the PiZero

So I ran the standard Pi bash update script thinking this would sort it out but got this

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

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       -
  Update Node.js LTS                  ✘   Failed to install Node.js - Exit
  Clean npm cache                     
  Install Node-RED core               
  Move global nodes to local          
  Install extra Pi nodes              
  Npm rebuild existing nodes          
  Add menu shortcut                   
  Update systemd script               
                                      

Any errors will be logged to   /var/log/nodered-install.log

:frowning:
any suggestions? (short of setting up the PiZero from scratch )
Simon

Did you npm install again ?

Between, I use this to install node 8.x on the zero:

1 Like

Easiest way is to remove both the node command and the update repository then re-run the script...

sudo rm /usr/bin/node
sudo rm -r /etc/apt/sources.list.d/nodesource.list
sudo apt-get update

then re-run the update bash command.

2 Likes

looking promising

pi@kitchencheer2:~ $ sudo rm /usr/bin/node
pi@kitchencheer2:~ $ sudo rm -r /etc/apt/sources.list.d/nodesource.list
pi@kitchencheer2:~ $ sudo apt-get update
Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.3 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]               
Get:4 http://archive.raspberrypi.org/debian stretch/main armhf Packages [173 kB]                   
Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [34.3 kB]                                                  
Fetched 11.9 MB in 44s (266 kB/s)                                                                                                                         
Reading package lists... Done
pi@kitchencheer2:~ $ bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
...    Running Node-RED update for user pi at /home/pi

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

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔
  Install Node.js for Armv6           ✔   Node v8.11.4   Npm 5.6.0
  Clean npm cache                     ✔
  Install Node-RED core               
  Move global nodes to local          
  Install extra Pi nodes              
  Npm rebuild existing nodes          
  Add menu shortcut                   
  Update systemd script               
                                      

Any errors will be logged to   /var/log/nodered-install.log

Yippee
Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js for Armv6 :heavy_check_mark: Node v8.11.4 Npm 5.6.0
Clean npm cache :heavy_check_mark:
Install Node-RED core :heavy_check_mark: 0.19.2
Move global nodes to local -
Install extra Pi nodes -
Npm rebuild existing nodes :heavy_check_mark:
Add menu shortcut :heavy_check_mark:
Update systemd script :heavy_check_mark:
id=Node-RED.desktop

All working fine :slight_smile:

1 Like

Thanks for this - I was able to get a project working on an Rpi3 to work on the Pi zero-w. But the mail node seems to be missing. Is this something I need to re-install from node-red?

Some nodes that were originally in the core now need to be manually installed, so the answer is yes.

That worked. I re-installed it from the pallet menu. I do notice much longer load times on the Pi Zero - up to 10m from power up to node-red being active. It is long on a Pi3 too, but usually only a few minutes.

Have you got a decent quality SD card? A cheap, non-branded (or fake) card can be slow. My Zeros take a few minutes, but not 10.

Yes. Sandisk Ultra 64Gbyte up to 100MB/s - I see 70 or so when doing disk copies. Writing slower, like 20ish. The slow time starting is only on first power up. If a kill node-red, then restart it, it goes much faster.
I did have a problem that I thought was a reliability issue, but turns out I had some code in GPIO that was waiting for a signal that occasionally didn't show up - wasn't an issue with Rpi3, but there have been some timing issues with the Zero needed adjusting. A timed delay fixed it.Seems to be very reliable now - running for a while to see how it does. Cross platform testing like this is a good way to expose program vulnerabilities!

1 Like

you may need to be slightly careful - as Pi0 is Arm6 based and Pi3 Arm7 - at one stage the binaries were different enough that a card installed on a Pi3 could not be moved to a Pi0 - whereas you could go from 0 to 3...

So far it seems the C code cross compiled using Eclipse and a rather old version of the compiler has worked fine, and SD cards moved from the Pi3 to the Pi0 will boot up and run code. So far the biggest issues were node-red not working - Illegal Instruction - (but the above changes fixed that), and some timing issues due to the arm6 running slower than the arm7. So far relatively easy to fix.
I've recently designed and built a monitoring 16s BMS with 16 additional sensor channels, fan and relay controls that's drive by the Rpi, and it needs to be VERY reliable. We've had many Rpi3s in the field for 8 years now monitoring other BMS (not our design), running flawlessly, so I know they are reliable. I use almost all the GPIO pins.

1 Like