Node-red stopped working?

pi@raspberrypi:~ $ ls ~/* -la | grep root
drwxr-xr-x  4 root root 4096 Jun  2 12:59 node-red-node-twitter
drwxrwxrwx  2 root root 4096 Dec 13  2016 .
-rwxrwxrwx  1 root root 4555 Dec 12  2016 dave.ovpn
-rw-r--r--  1 root root 4567 Dec 13  2016 Dave.ovpn
-rwxrwxrwx  1 root root 4578 Jun 27  2016 g6zkc.ovpn
-rwxrwxrwx  1 root root 4566 Mar  8  2016 Rasp.ovpn
-rwxrwxrwx  1 root root 4570 Mar  8  2016 RRasp.ovpn
-rwxrwxrwx  1 root root 3591 Dec 12  2016 rrrasp.ovpn
pi@raspberrypi:~ $

You have still got a node-red-node-twitter folder owned by root somewhere, I should have said use this command, then it would show the full path
ls ~/* -lda |grep root

That is VERY bad since the whole folder appears to be owned by root. So new files/folders will be owned by root as default.

Sort this out with something like:

sudo chown -R pi:pi /home/pi

Sorry, I'm not in front of a pi right now so you will need to double check that command.

I've applied sudo chown -R pi:pi /home/pi and now ls ~/* -la | grep root shows nothing (other than a prompt). - I'll hang fire running the install script until after lunch

Actually that is now good as it shows that nothing in there is now owned by root

@dceejay That's what I thought. Is it ok just to delete the ~/.node-redOLD directory after I've reinstalled NR ?

Well that didn't go as well as expected I reinstall the flows and then slowly the missing nodes hit deploy and it just spins and spins after >20 mins a did a sudo reboot and top reports.:anguished: Do I just start over again - delete ~/.node-red

top - 16:09:54 up 36 min,  2 users,  load average: 1.08, 1.11, 1.02
Tasks: 156 total,   2 running, 154 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.2 sy, 25.3 ni, 74.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:    750636 total,   714532 used,    36104 free,    56540 buffers
KiB Swap:   102396 total,       56 used,   102340 free.   218812 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  457 pi        25   5  207756 118772  25608 R 101.0 15.8  37:41.74 node-red
 1692 pi        20   0    5112   2420   2024 R   0.7  0.3   0:15.26 top
  516 mosquit+  20   0    5092   3576   3176 S   0.3  0.5   0:03.25 mosquitto
 1234 pihole    20   0  331312 268624   3588 S   0.3 35.8   0:51.29 pihole-FTL
 1532 pi        20   0    9380   3500   2852 S   0.3  0.5   0:01.68 sshd
    1 root      20   0    5784   4068   2788 S   0.0  0.5   0:07.90 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.14 ksoftirqd/0

what does the node-red log say?

It was all going so well, One thing I noticed when I rename ~./node-red to ~./node-redXXX a new ~./node-red is generator automatically after a reboot

pi@raspberrypi:~ $ node-red-log


4 Jun 19:00:41 - [info] [mqtt-broker:458b4dd.43da3b4] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:66589846.d730a8] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:b10f9abc.4f3fd8] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:f2c7c5e7.21ca58] Disconnected from broker:                                                                                         mqtt://192.168.1.60:1883
4 Jun 19:00:41 - [info] [mqtt-broker:54bf0c8a.acccd4] Disconnected from broker:                                                                                         mqtt://192.168.1.60:1883
4 Jun 19:00:41 - [info] [mqtt-broker:3737622f.c070de] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:d8356bdc.d5f088] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:22a35f86.d5cb7] Disconnected from broker: m                                                                                        qtt://192.168.1.60:1883
4 Jun 19:00:41 - [info] [mqtt-broker:4ecb3d68.adea54] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:7f818964.f99448] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:e1a8b050.70a88] Disconnected from broker: m                                                                                        qtt://192.168.1.60:1883
4 Jun 19:00:41 - [info] [mqtt-broker:24eb17ed.198018] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:315a26c2.86bc5a] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:f891df3d.f6d4e] Disconnected from broker: m                                                                                        qtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:70fa8bbc.d75524] Disconnected from broker:                                                                                         mqtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:ab08b3dd.c443f] Disconnected from broker: m                                                                                        qtt://192.168.1.40:1883
4 Jun 19:00:41 - [info] [mqtt-broker:CloudMQTT] Disconnected from broker: mqtts:                                                                                        //m23.cloudmqtt.com:26499
4 Jun 19:00:56 - [error] [mqtt-broker:24b981a2.cba26e] Error stopping node: Clos                                                                                        e timed out
4 Jun 19:00:56 - [info] Stopped flows
4 Jun 19:00:56 - [info] Starting flows
4 Jun 19:00:56 - [error] [emoncms:169fafd3.6dfef] TypeError: Cannot read propert                                                                                        y 'server' of null
4 Jun 19:00:56 - [info] [worldmap:78a7a40a.7ea33c] started at /worldmap
4 Jun 19:00:56 - [error] [openweathermap:fakename WX] No API key set
4 Jun 19:00:57 - [error] [openweathermap:fakename WX] No API key set
4 Jun 19:00:57 - [error] [openweathermap:fakename WX] No API key set

I think I've found the issue, my second from last flow I reinstalled has a problem within it. So this time I installed it first of all. When I deployed that flow it just sits even though the log says starting flows

And the log

pi@raspberrypi:~ $ node-red-log


4 Jun 19:23:01 - [info] Added node types:
4 Jun 19:23:01 - [info]  - node-red-contrib-bigtimer:bigtimer
4 Jun 19:23:01 - [info] Installing module: node-red-contrib-ds18b20-sensor, vers                                                ion: 1.3.6
4 Jun 19:23:15 - [info] Installed module: node-red-contrib-ds18b20-sensor
4 Jun 19:23:15 - [info] Added node types:
4 Jun 19:23:15 - [info]  - node-red-contrib-ds18b20-sensor:rpi-ds18b20
4 Jun 19:23:32 - [info] Installing module: node-red-contrib-schedex, version: 1.                                                6.0
4 Jun 19:23:48 - [info] Installed module: node-red-contrib-schedex
4 Jun 19:23:49 - [info] Added node types:
4 Jun 19:23:49 - [info]  - node-red-contrib-schedex:schedex
4 Jun 19:24:06 - [info] Installing module: node-red-contrib-solar-power-forecast                                                -plus, version: 2.0.6
4 Jun 19:24:19 - [info] Installed module: node-red-contrib-solar-power-forecast-                                                plus
4 Jun 19:24:19 - [info] Added node types:
4 Jun 19:24:19 - [info]  - node-red-contrib-solar-power-forecast-plus:solar powe                                                r forecast plus
4 Jun 19:24:45 - [info] Installing module: node-red-contrib-solar-power-forecast                                                , version: 1.0.3
4 Jun 19:24:58 - [info] Installed module: node-red-contrib-solar-power-forecast
4 Jun 19:24:58 - [info] Added node types:
4 Jun 19:24:58 - [info]  - node-red-contrib-solar-power-forecast:solar power for                                                ecast
4 Jun 19:24:58 - [info] Installing module: node-red-contrib-time-range-switch, v                                                ersion: 0.6.1
4 Jun 19:25:12 - [info] Installed module: node-red-contrib-time-range-switch
4 Jun 19:25:12 - [info] Added node types:
4 Jun 19:25:12 - [info]  - node-red-contrib-time-range-switch:time-range-switch
4 Jun 19:25:14 - [info] Stopping flows
4 Jun 19:25:14 - [info] Stopped flows
4 Jun 19:25:14 - [info] Starting flows

Yes, thta's to be expected since Dave's script adds a systemd entry for you so that Node-RED starts at boot. When NR starts and can't find its userDir, it creates it for you.

looks ok at the end... (apart from missing the weather node credentials which is not surprising as they have been moved.)
Can you now browse to the flow ?

OK, so you've got something to look at in NR now. You can, of course stop Node-RED using sysctrl. and then start manually with the --safe parameter if you need to.

You can also see the benefits of using an alternate installation scheme that lets you run up multiple different versions of NR if you need to. Harder to set up initially but once done, arguably less easy to get into trouble. Or at least easier to recover.

Failing that, you should perhaps consider buying a spare SD-card and install a vanilla OS and perhaps NR so that you have a known, clean OS to boot to in case of emergency.

1 Like

You might also consider backing up the .node-red folder from time-to-time. I usually do it before any major updates to either Node.js or Node-RED. Doing it before doing something big to your flow is also good.

1 Like

No, just a greyed out screen continues to 'deploy'. I think the original problem may have stemmed from that node.

Thinking out of the box we did have a power blip (cables replaced in near road) but the two didn't coincide time wise.

Funny you mention about backing up the last couple of days I have backup (imaged) my four PI's and laptops
1 Pi FreePBX
2 Pi Gafana, influxdb, emoncms
3 Pi OSMC
4 Pi Node-red, etc etc etc .... (or as it's now called 'trouble'!)
All the configs from the D1 mini's around the place.

1 Like

You should always keep electronics on at least a filtered extension block. Pi's are also quite susceptible to power issues corrupting files. So I always keep mine on a PC UPS - along with my router, switch and WiFi AP.

I have it all on a 'filtered' power strip (two MOV's from memory when I looked) but a UPS might be a good as well as a backup OS, as you mentioned. (The 3 PI's, wifi router,SPA3102,Cisco switch are on the floor in the hall much to my wives distaste :wink:)

I think one issue might be installing the flows before the missing nodes ??

1 Like

Well things eventually seem more or less back to where they were, the dashboards are a messed up a bit but than can be sorted.

I would like give a BIG THANKYOU :beers::beer: to all those who bore with me.
I've learnt a lot and hopefully this thread will help others, the key points are.

BACK UP the entire .node-red directory and an image of the PI SD
node-red-stop node-start and especially node-red --safe.
plus all the other VERY helpful tips !

Thanks again !
Dave.
PS my wife as gives thanks for a happy husband :grin:

1 Like

Well, you have a more understanding wife than mine who would not stand for that! Thankfully I have an office at home.

More confusing than anything really but I'd always prefer to get NR working first otherwise my OCD gets twitchy. :slight_smile: