hassio-addons/addon-node-red

Error binding port 5353 (multicast DNS) #562

buekera posted onGitHub

Problem/Motivation

I'd like to run Node-RED as an addon to Home Assistant but get an error when trying to start.

Expected behavior

Node-RED should start it's docker container successfully.

Actual behavior

Throwing error:


> addon-node-red@ start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"

9 May 15:25:09 - [info] 

Welcome to Node-RED
===================

9 May 15:25:09 - [info] Node-RED version: v1.0.5
9 May 15:25:09 - [info] Node.js  version: v12.15.0
9 May 15:25:09 - [info] Linux 4.15.0-88-generic x64 LE
9 May 15:25:09 - [info] Loading palette nodes
9 May 15:25:10 - [info] Dashboard version 2.20.0 started at /endpoint/ui
Traceback (most recent call last):
  File "/opt/node_modules/node-red-node-pi-gpio/testgpio.py", line 4, in <module>
    import RPi.GPIO as GPIO
  File "/usr/lib/python2.7/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
9 May 15:25:10 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
9 May 15:25:10 - [red] Uncaught Exception:
9 May 15:25:10 - Error: bind EADDRINUSE 0.0.0.0:5353
    at dgram.js:334:20
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! addon-node-red@ start: `node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the addon-node-red@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-05-09T13_25_10_984Z-debug.log

I think the RPi error can be ignored here. The interesting part is Error: bind EADDRINUSE 0.0.0.0:5353

Steps to reproduce

Installed Home Assistant as supervised on Ubuntu machine with machine flag qemux86_64. This installation makes use of docker. docker ps output:

ae62fc380446        homeassistant/amd64-hassio-supervisor            "/init"                  18 hours ago        Up 18 hours                                                                                             hassio_supervisor
ad7f9fc81af7        homeassistant/qemux86-64-homeassistant:0.109.4   "/init"                  3 days ago          Up 39 hours                                                                                             homeassistant
b9cc48fefb75        homeassistant/amd64-hassio-dns:9                 "/init coredns -conf…"   4 days ago          Up 18 hours                                                                                             hassio_dns
96ba76f1784f        homeassistant/amd64-hassio-audio:14              "/init"                  4 days ago          Up 4 days                                                                                               hassio_audio
1a82131bb8eb        homeassistant/amd64-hassio-cli:25                "/init /bin/bash -c …"   4 days ago          Up 4 days                                                                                               hassio_cli
dd7c6d9c19c2        homeassistant/amd64-hassio-multicast:2           "/init"                  4 days ago          Up 18 hours                                                                                             hassio_multicast

You can see hass.io is already running some sort of multicast which maybe causes the bind on port 5353. Why Node-RED needs to bind port 5353 eludes my knowledge.

Proposed changes

Disable multicast/port 5353 binding on Node-RED?

Maybe someone can tell my why this is needed.

I'm thankful for any hint.


:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be useful.

posted by addons-assistant[bot] almost 5 years ago

Do you have any custom palette nodes installed? Specifically around Homekit?

posted by sinclairpaul almost 5 years ago

@sinclairpaul Hey threre! The HA installation is nearly fresh. I just integrated some stuff and added a custom card for my Lovalace dashboard: grafik

I did not add any nodes or something.

I have to admit that there are some other docker containers running but I have full control over the ports they are using and no container is bound to port 5353.

posted by buekera almost 5 years ago

Node-RED does not use these port out of the box, hence Paul asking about your used pallets... It would be nice if you could answer that question.

posted by frenck almost 5 years ago

Sure: I don't know

I neither heard of that before nor did I actively/knowingly install any paletts. I just used the addon browser of HA and hit "install" for Node-RED.

Can you enlighten me what a "palette" exaclty is or guide me to where I can read about it? Google doesn't exaclty tell me anything useful I feel like.

Here my Node-RED config:

dark_mode: false
http_node:
  username: ''
  password: ''
http_static:
  username: ''
  password: ''
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: false
system_packages: []
npm_packages: []
init_commands: []
posted by buekera almost 5 years ago

Weird.

Sorry, but can't reproduce the issue. The add-on has no problem with mDNS in general, unless a manual adjustment is made or one has a misconfigured system.

Never had this report in this pas years.

posted by frenck almost 5 years ago

config/node-red/package.json will show anything additionally installed. The palettes are essentially npm packages.

Is this really a fresh blank install? As this is very odd. If you want to fully remove Node Red you need to uninstall the addon and remove the node-red folder from config.

posted by sinclairpaul almost 5 years ago

Hm, pretty strange that something is trying to bind to port 5353 and you tell me that this is not normal behavior. I will have a look into the debug logs and report back here when I find something interesting.

posted by buekera almost 5 years ago

I just had a glance at the debug log from npm but can not see more information that would help. This log is from within the docker container:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'start',
1 verbose cli   '--',
1 verbose cli   '--settings',
1 verbose cli   '/etc/node-red/config.js'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle addon-node-red@~prestart: addon-node-red@
6 info lifecycle addon-node-red@~start: addon-node-red@
7 verbose lifecycle addon-node-red@~start: unsafe-perm in lifecycle true
8 verbose lifecycle addon-node-red@~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle addon-node-red@~start: CWD: /opt
10 silly lifecycle addon-node-red@~start: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"'
10 silly lifecycle ]
11 silly lifecycle addon-node-red@~start: Returned: code: 1  signal: null
12 info lifecycle addon-node-red@~start: Failed to exec start script
13 verbose stack Error: addon-node-red@ start: `node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid addon-node-red@
15 verbose cwd /opt
16 verbose Linux 4.15.0-88-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" "--" "--settings" "/etc/node-red/config.js"
18 verbose node v12.15.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error addon-node-red@ start: `node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"`
22 error Exit status 1
23 error Failed at the addon-node-red@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
posted by buekera almost 5 years ago

Oh I didn't see your last post. I will have a look.

posted by buekera almost 5 years ago

package.json:

    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true,
    "dependencies": {}
}
posted by buekera almost 5 years ago

I personally would lean towards something at a system level, there is no UFW involved here is there?

As Frenck mentioned this isn't something that has been seen before, and there are many users of Node Red πŸ˜‰

posted by sinclairpaul almost 5 years ago

I will close this issue as I agree with @sinclairpaul's statement. It has to be something on my system and I will investigate further.

Thanks for the help! :-)

posted by buekera almost 5 years ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

posted by addons-assistant[bot] almost 5 years ago

Fund this Issue

$0.00
Funded

Pull requests