hassio-addons / addon-node-red

Node-RED - Home Assistant Community Add-ons
https://addons.community
MIT License
514 stars 117 forks source link

Node Red Add-On will not start #1537

Closed Ventusfahrer closed 1 year ago

Ventusfahrer commented 1 year ago

Problem/Motivation

Node Red is no longer starting:

(Add On) Protocol output:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 14.0.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (aarch64 / odroid-n2)
 Home Assistant Core: 2022.12.9
 Home Assistant Supervisor: 2022.12.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-nginx: starting
s6-rc: info: service init-customizations: starting
s6-rc: info: service init-customizations successfully started
s6-rc: info: service init-nodered: starting
patching file nodes/ui_base.html
Hunk #1 succeeded at 1164 (offset 633 lines).
s6-rc: info: service init-nginx successfully started
up to date, audited 5 packages in 3s
found 0 vulnerabilities
s6-rc: info: service init-nodered successfully started
s6-rc: info: service nodered: starting
s6-rc: info: service nodered successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[12:39:49] INFO: Starting Node-RED...
> start
> node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js
4 Jan 12:39:52 - [info] 
Welcome to Node-RED
===================
4 Jan 12:39:52 - [info] Node-RED version: v3.0.2
4 Jan 12:39:52 - [info] Node.js  version: v18.12.1
4 Jan 12:39:52 - [info] Linux 5.15.79 arm64 LE
4 Jan 12:39:53 - [info] Loading palette nodes
4 Jan 12:39:57 - [info] Dashboard version 3.3.0 started at /endpoint/ui
4 Jan 12:39:58 - [info] Settings file  : /etc/node-red/config.js
4 Jan 12:39:58 - [info] Context store  : 'default' [module=memory]
4 Jan 12:39:58 - [info] User directory : /config/node-red/
4 Jan 12:39:58 - [warn] Projects disabled : editorTheme.projects.enabled=false
4 Jan 12:39:58 - [info] Flows file     : /config/node-red/flows.json
4 Jan 12:39:58 - [warn] Encrypted credentials not found
4 Jan 12:39:58 - [info] Server now running at http://127.0.0.1:46836/
4 Jan 12:39:58 - [info] Starting flows
4 Jan 12:39:58 - [error] [api-call-service:ccb2f059.1d384] Error: Server config node not found
[12:39:58] INFO: Starting NGinx...

docker stats reports:

CONTAINER ID   NAME                        CPU %     MEM USAGE / LIMIT     MEM %     NET I/O           BLOCK I/O         PIDS
16117a433927   addon_a0d7b954_nodered      100.39%   149.2MiB / 3.577GiB   4.07%     0B / 0B           0B / 893kB        40

docker ps :

16117a433927   ghcr.io/hassio-addons/node-red/aarch64:14.0.1               "/init"   10 minutes ago   Up 10 minutes (health: starting)                                                                                                                                  addon_a0d7b954_nodered

the container is restarted after some while, because it never ends the status starting.

Expected behavior

Node Red should start completely and allow to fix problems.

Actual behavior

Node Red Docker does not completly start and is obviously looping. No connection browser-connection http://mynoderednode:1880 is possible.

Steps to reproduce

The error is caused by importing the 3rd option, saving it without any changes (adoption to existing entities). After restarting the Node-Red add-on, it will fail to start completly:

Proposed changes

no idea.

The workaround to get it started again is to either restore a backup of /usr/share/hassio/homeassistant/node_red/flows.json or edit this file and remove the node containing the bugous definition. The name of the node is referenced in the error message of the protocol 4 Jan 12:39:58 - [error] [api-call-service:ccb2f059.1d384].

The name of the node is the BOLD-marked part of the error message.

ghost commented 1 year ago

Have this in my logs and can't open the web UI.

9 Jan 15:45:25 - [error] [api-current-state:ea016844fbd77eb3] Error: Invalid server config 9 Jan 15:45:25 - [error] [api-call-service:79226da3b8532425] Error: Server config node not found 9 Jan 15:45:25 - [error] [api-call-service:72695ef434559d19] Error: Server config node not found 9 Jan 15:45:25 - [error] [api-call-service:bd7bdb8dc7daaec2] Error: Server config node not found 9 Jan 15:45:25 - [error] [api-call-service:0ed98d2fc6372b58] Error: Server config node not found [15:45:25] INFO: Starting NGinx... 9 Jan 15:45:25 - [info] Started flows 9 Jan 15:45:30 - [info] [server:Home Assistant] Connecting to http://supervisor/core 9 Jan 15:45:30 - [info] [server:Home Assistant] Connected to http://supervisor/core

Ventusfahrer commented 1 year ago

the only way I found to get it running again was to remove some lines in config/node-red/flows.json.

If you immediately detect the problem after your change, you might restore the backup of flows.json. I am talking about a supervised installation on Odroid Debian (Raspi 4 looks identically).

I assume that you can deal with an ssh-session and you are able to ssh and elevate your process to root (aka sudo -i).

Make safety copies of the related files outside the hassio directory tree before changing them The file is located in /usr/share/hassio/homeassistant/node-red.

1st have a look at the files in this directory:

peter@7vhas:/usr/share/hassio/homeassistant/node-red$ ls -la
total 200
drwxr-xr-x  5 root root  4096 Jan  7 12:23 .
drwxr-xr-x 13 root root  4096 Jan  9 15:25 ..
-rw-r--r--  1 root root 41498 Jan  2 20:57 .config.nodes.json
-rw-r--r--  1 root root 41498 Jan  2 20:57 .config.nodes.json.backup
-rw-r--r--  1 root root   779 Jan  6 21:07 .config.users.json
-rw-r--r--  1 root root   778 Jan  6 21:07 .config.users.json.backup
-rw-r--r--  1 root root 26058 Jan  7 11:37 .flows.json.backup
-rw-r--r--  1 root root 33673 Jan  9 16:48 flows.json
drwxr-xr-x  3 root root  4096 Dec 24 00:20 lib
-rw-r--r--  1 root root    17 Jan  7 12:23 node-red-contrib-home-assistant-websocket.json
drwxr-xr-x  6 root root  4096 Dec 26 16:11 node_modules
drwxr-xr-x  2 root root  4096 Dec 24 00:18 nodes
-rw-r--r--  1 root root  1728 Jan  7 12:22 package-lock.json
-rw-r--r--  1 root root   195 Dec 26 16:11 package.json
-rw-r--r--  1 root root  7663 Dec 24 00:18 settings.js

if you are lucky, then your problem is fixed by restoring the last backup of:

cp .flows.json.backup flows.json

Restart hassio and look whether this already helps.

If not, things are getting more complicate. But first check whether restoring backup will help.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!