Lost flows after upgrade on raspberry pi4

I've been running Node-Red on a Raspberry pi4 and just did a sudo apt-get upgrade and node-red stopped while this was running. When I restarted it all my flows were gone. Never had this happen before... should I be able to recover these as it was quite extensive.

Look in your /home/pi/.node-red directory.

Copy/paste the file list here.
(Or do a screen shot showing the files)

Did you use the recommended install script when installing initially?

What do you see in the terminal when you start node-red? Copy/paste it here please rather than a screenshot, if possible.

I was able to recover for the most part by copy and paste from flows_raspberrypi.json and importing. Still working through a few issues.

I dont recall if I used the install script or not it was quite some time ago
everything seems to be working... I do have to login to localhost:4567 each time I restart node-red

8 Aug 09:47:35 - [info] Starting flows
8 Aug 09:47:35 - [info] [alexa-remote-account:latest] intialising "latest" with the PROXY method and NO saved data...
8 Aug 09:47:35 - [info] [alexa-remote-account:myalexa] intialising "myalexa" with the PROXY method and NO saved data...
8 Aug 09:47:36 - [info] Started flows
8 Aug 09:47:37 - [warn] [alexa-remote-account:latest] open localhost:3456 in your browser
8 Aug 09:47:37 - [warn] [alexa-remote-account:myalexa] open localhost:4567 in your browser
8 Aug 09:47:37 - [info] [mqtt-broker:pi4_mqtt] Connected to broker: mqtt://localhost:1883
8 Aug 09:47:37 - [info] [mqtt-broker:mymqtt] Connected to broker: mqtt://localhost:1883
8 Aug 09:47:37 - [info] [alexa-remote-account:alexa account] intialising "alexa account" with the PROXY method and saved data...
8 Aug 09:48:27 - [warn] [alexa-remote-account:myalexa] failed to load routines: "routines.map is not a function"
8 Aug 09:48:28 - [warn] [alexa-remote-account:myalexa] failed to load smarthome devices: "{"success":true}"

The full output please, from the command you run.

I'm not sure what you are referring to

I asked

But you only posted the second half of the output, from the Starting flows message.

Welcome to Node-RED

8 Aug 09:47:29 - [info] Node-RED version: v1.3.4
8 Aug 09:47:29 - [info] Node.js version: v10.24.0
8 Aug 09:47:29 - [info] Linux 5.4.79-v7l+ arm LE
8 Aug 09:47:31 - [info] Loading palette nodes
8 Aug 09:47:34 - [info] Dashboard version 2.26.1 started at /ui
8 Aug 09:47:35 - [info] Settings file : /home/pi/.node-red/settings.js
8 Aug 09:47:35 - [info] Context store : 'default' [module=memory]
8 Aug 09:47:35 - [info] User directory : /home/pi/.node-red
8 Aug 09:47:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
8 Aug 09:47:35 - [info] Flows file : /home/pi/.node-red/restart
(node:15251) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:15251) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15251) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
8 Aug 09:47:35 - [info] Server now running at http://127.0.0.1:1880/
8 Aug 09:47:35 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

8 Aug 09:47:35 - [info] Starting flows
8 Aug 09:47:35 - [info] [alexa-remote-account:latest] intialising "latest" with the PROXY method and NO saved data...
8 Aug 09:47:35 - [info] [alexa-remote-account:myalexa] intialising "myalexa" with the PROXY method and NO saved data...
8 Aug 09:47:36 - [info] Started flows
8 Aug 09:47:37 - [warn] [alexa-remote-account:latest] open localhost:3456 in your browser
8 Aug 09:47:37 - [warn] [alexa-remote-account:myalexa] open localhost:4567 in your browser
8 Aug 09:47:37 - [info] [mqtt-broker:pi4_mqtt] Connected to broker: mqtt://localhost:1883
8 Aug 09:47:37 - [info] [mqtt-broker:mymqtt] Connected to broker: mqtt://localhost:1883
8 Aug 09:47:37 - [info] [alexa-remote-account:alexa account] intialising "alexa account" with the PROXY method and saved data...
8 Aug 09:48:27 - [warn] [alexa-remote-account:myalexa] failed to load routines: "routines.map is not a function"
8 Aug 09:48:28 - [warn] [alexa-remote-account:myalexa] failed to load smarthome devices: "{"success":true}"

alexa-local lib restart
authlog node_modules restart_cred
flows_raspberrypi_cred.json package.json settings.js
flows_raspberrypi.json package-lock.json start

I guess you started node red using the command
node-red restart
That starts node red and tells it to use a flows file called restart in the .node-red folder. To start node-red you should use node-red-start to start it as a service (assuming you installed using the script) or you can just use the command node-red to start it in a terminal not as a service. The reason you apparently lost your flows is because you told it to use a non-existent flows file.

1 Like

I believe the distribution of raspbian I installed came with everything already setup including thonny which I also use to program ESP32 devices which communicate with node-red.

You've mentioned it a couple of times so there any way to tell.

When are the start and restart files created?

What files do you mean? If you mean the commands then they are created by the install script. The node-red command should be there however you installed node-red. We know it is there because you used it already.

Thanks for you patience... I have clearly created most of my problems... primarily the misuse of node-red commands node-red start and node-red restart as opposed to node-red-start and node-red-restart. There are files called start and restart in the node-red directory that appear to be flows. The restart one is the one I need to use as they are different. I am curious what is normally loaded when the I reboot the device as node-red starts automatically. It is different from what is loaded if I use node-red restart. My goal at this point would be to have the flows that are loaded with a normal start as in a reboot to load the flows that I get with node-red restart. There is also the file flows_raspberyypi.json which is the one I copied from and imported to recover my seemingly lost flows. So my question is when are these created or updated to what you are running.
Hope that all makes sense

Assuming the host name of the pi is raspberrypi then the reboot is probably running that one. You can find out by running node-red (which will almost certainly run the same one as on boot) and looking in the log. Also, the node-red-start command should run that one (it will say started as a service which tells you that it is running the bootup version). node-red-start drops into the log output when it starts so again you can check which file it is using. I don't generally use node-red-restart as it doesn't show the log. I usually use node-red-stop;node-red-start which does the same thing but shows the log.

The first time you ran node-red start (or restart) it would have told you in the log that it was creating a new flows file called start.

I suggest you backup all the flows files there and then if you know which one is the one you want to use then rename it to the raspberrypi name, remove the others, and you should be good to go.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.