Unable to start Node-red upon boot

well - I'm still not quite sure why your install is so truculent.
does the node-red-start and node-red-log command now work after a reboot and when run as root. ?

Well, node-red-start does sort of attempt to start node-red but it never gets beyond "starting as root systemd service". Really sorry this is such a faff.

Running Node-RED install for user root at /root on raspbian


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       ✔  v0
  Update Node.js LTS                  ✔   Node v12.17.0   Npm 6.14.4
  Clean npm cache                     ✔
  Install Node-RED core               ✔   1.0.6 
  Move global nodes to local          -
  Install extra Pi nodes              ✔
  Npm rebuild existing 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  1 Jun 22:37:05 BST 2020  -  Finished  Mon  1 Jun 22:39:34 BST 2020

root@raspbx:~# systemctl enable nodered.service
root@raspbx:~# node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.118:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as root systemd service.
 
^C
root@raspbx:~# journalctl -f  -u nodered
-- Logs begin at Thu 2016-11-03 17:16:45 GMT. --
Jun 01 21:01:10 raspbx Node-RED[353]: then retry  node-red-start
Jun 01 21:01:10 raspbx Node-RED[353]:  
Jun 01 22:40:10 raspbx systemd[1]: Started Node-RED graphical event wiring tool.
Jun 01 22:40:10 raspbx Node-RED[22239]: [21B blob data]
Jun 01 22:40:10 raspbx Node-RED[22239]: Node-RED is not yet fully installed. Please re-run the install script again manually.
Jun 01 22:40:10 raspbx Node-RED[22239]:  
Jun 01 22:40:10 raspbx Node-RED[22239]:    bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Jun 01 22:40:10 raspbx Node-RED[22239]:  
Jun 01 22:40:10 raspbx Node-RED[22239]: then retry  node-red-start
Jun 01 22:40:10 raspbx Node-RED[22239]:

Still trying to debug this. Is it strange that NPM is not installed by the bash script?

root@raspbx:~ $ apt purge nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'npm' is not installed, so not removed
The following packages will be REMOVED:
  nodejs*
0 upgraded, 0 newly installed, 1 to remove and 125 not upgraded.
After this operation, 84.3 MB disk space will be freed.
Do you want to continue? [Y/n] y

What I'm finding is every time I run the bash script then type node-red-start it says
Node-RED is not yet fully installed. Please re-run the install script again manually.

this is mad... ok... what does which node-red-pi now say... as it's the only way to get here now...

/root/.npm-packages/bin/node-red-pi
EDIT: The most recent install log

EDIT 2: The first time I try node-red-start after 'installation' with the script it says this:

root@raspbx:~# sudo systemctl enable nodered.service
root@raspbx:~# node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.118:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as root systemd service.

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

then retry  node-red-start

the second time I try it, it says this

root@raspbx:~# node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.118:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as root systemd service.

but neither time does the command node-red-start return

However, as before, if I run /root/.npm-packages/bin/node-red-pi then node-red starts successfully, but only within that session, NOT as a service

yeah it's 99% good... but /root/.npm-packages/bin/node-red-pi is obviously not in the environment path when the service runs - it should be over in /usr/bin
ugly - but lets try - ln -s $(which node-red-pi) /usr/bin/node-red-pi
(as root)
then retry node-red-start

1 Like

Closer

hmm not really :frowning:

The key 'take home' I'm getting is that for some reason even after the installation node-red keeps reporting the installation isn't finished/complete - it wants me to rerun it manually. We-running it manually isn't something I know how to do, but I'd be very up for giving it a go!

Maybe another tack. Where can I get a copy of the original system image ?
It may just be quicker if I can duplicate the whole setup.

Well by manually I just mean re-run the bash script as that should complete... usually the only reason we get here is if it failed for some reason - like internet connection breaks etc... but something is def odd about the underlying setup here...

but if you want to go really manual you could run npm i -g --unsafe-perm node-red as root (not sudo)

Wow. You're a brick! Here. Goodness.
What's 100% bizarre is that Node-Red WAS working fine for months and months on this self same setup. The only reason I wanted to upgrade was after making a change or two to my palette and a flow, something caused constant 100% usage and for the Pi to become unresponsive. I thought upgrading might help. Ooops.

Which version are you using - some of the messages above mention Stretch - but that web page says
"Pi 1 and Pi zero models are no longer supported. Please refer to the previous Stretch based images for Pi 1 and Pi zero hardware."
so looks like stretch may be a previous version...

Think it'll be this one

I am not surprised I am having difficulty following this as that quote is from the original question.

it restarted at post 28

OK - downloaded that image... burst to SD card.
booted - ssh in as root
ran apt update && apt full-upgrade && apt autoremove
to update and cleanup
ran Node-RED bash install script. saying yes to installing as root.
ran node-red-start... ALL GOOD !

so yeah... not much more I can think of right now - apart from blowing it away again as we did yesterday - then installing as root (and stick with root).

and if which node-red-pi still insists in being under that root folder - copy (rather than link) a version over manually to ./usr/bin.

1 Like

Hi there
Just wanted to explain the lack of a reply. At some point today my Pi died - or rather the SD card most likely has died. I'm not really surprised - I'd been hammering it with uninstall and reinstalls of Node,NPM and Node-Red and at some point it just closed the SSH connection and when I relogged in from home I did a reboot to bring SSH backup it never powered back up. Guessing something somewhere is corrupt. I get a red LED but no ACT LED.
So HUGE thanks for your help but I have every confidence once I reflash RasPBX I too will be able to install as normal. Just have no idea what was going on with that sytem which is now toast.
Thanks - you've been brilliant.

Good luck FWIW I upgraded my image to their Buster version it also works fine for me.

Well, I'm amazed and delighted but I was able to bring that SD card back to life.
The apt-get update had borked in the middle of its run and deleted most of the files from the /boot folder leaving only a couple of text files and an overlay folder. I redownloaded the files from here and to my intense delight I'm back up and running.

I have noticed that my disk usage is somehow hovering around 98-98% and I'm wondering if that's why the script is failing to work properly (even though it initially thinks it has worked).

So I'll run some reports to see what if anything I can purge then have another go.

I'd just reimage the disk if I didn't know reconfiguring FreePBX from restoring from backups is going to be an absolute PITA. The FreePBX backup/restore is a hot mess.

This is still a very curious problem when running from the user's session works perfectly but running as a service just ...won't. :slight_smile: :slight_smile: