Adress already in use?

So I tried to install HADashboard today, first off I’m not sure if I should install appdaemon as the HASS user or the pi user so I did it just as the normal Pi!
Installed it and set up the config and a simple hello dashboard but when I try to start it I get a message that the adress is already in use?

pi@raspberrypi:/home/hass/.homeassistant/conf $ sudo appdaemon -c /home/hass/.homeassistant/conf
2018-04-03 20:38:59.843070 INFO AppDaemon Version 3.0.0 starting
2018-04-03 20:38:59.844148 INFO Configuration read from: /home/hass/.homeassistant/conf/appdaemon.yaml
2018-04-03 20:38:59.846655 INFO AppDaemon: Starting Apps
2018-04-03 20:38:59.847611 ERROR AppDaemon: Invalid value for app_dir: /home/hass/.homeassistant/conf/apps
2018-04-03 20:38:59.848313 INFO Starting Dashboards
2018-04-03 20:38:59.862601 INFO API is disabled
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1042, in create_server
    sock.bind(sa)
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/appdaemon", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 365, in main
    admain.main()
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 361, in main
    self.run(appdaemon, hadashboard)
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 80, in run
    loop.run_until_complete(asyncio.gather(*pending))
  File "/usr/lib/python3.5/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1046, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5050): address already in use
pi@raspberrypi:/home/hass/.homeassistant/conf $

So I ran a netstatto check but no App looks to be using 5050?

pi@raspberrypi:/home/hass/.homeassistant/conf $ netstat --tcp --listening --programs --numeric
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:1880            0.0.0.0:*               LISTEN      350/node-red
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:4711          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9001            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:27117         0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::53                   :::*                    LISTEN      -
tcp6       0      0 ::1:3350                :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
tcp6       0      0 :::3000                 :::*                    LISTEN      -
tcp6       0      0 ::1:5432                :::*                    LISTEN      -
tcp6       0      0 ::1:25                  :::*                    LISTEN      -
tcp6       0      0 :::5050                 :::*                    LISTEN      -
tcp6       0      0 :::8443                 :::*                    LISTEN      -
tcp6       0      0 :::1883                 :::*                    LISTEN      -
tcp6       0      0 :::3389                 :::*                    LISTEN      -
tcp6       0      0 :::445                  :::*                    LISTEN      -
tcp6       0      0 :::8384                 :::*                    LISTEN      837/syncthing
tcp6       0      0 :::6789                 :::*                    LISTEN      -
tcp6       0      0 :::9001                 :::*                    LISTEN      -
tcp6       0      0 :::8843                 :::*                    LISTEN      -
tcp6       0      0 :::139                  :::*                    LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::8880                 :::*                    LISTEN      -
tcp6       0      0 :::8080                 :::*                    LISTEN      -
tcp6       0      0 :::22000                :::*                    LISTEN      837/syncthing
tcp6       0      0 :::80                   :::*                    LISTEN      -

Any help would be great!

Fixed atleast the app error at the top, found out that it should be disable_apps: true and not disable_apps: 1 as it says in the HADashboard help text!
Stil got the error that it’s in use tough:

 pi@raspberrypi:/home/hass/.homeassistant/conf $ sudo appdaemon -c /home/hass/.homeassistant/conf
2018-04-03 20:53:03.328119 INFO AppDaemon Version 3.0.0 starting
2018-04-03 20:53:03.329153 INFO Configuration read from: /home/hass/.homeassistant/conf/appdaemon.yaml
2018-04-03 20:53:03.331614 INFO AppDaemon: Apps are disabled
2018-04-03 20:53:03.332897 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-04-03 20:53:04.078149 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-04-03 20:53:04.079602 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-04-03 20:53:04.080857 INFO Starting Dashboards
2018-04-03 20:53:04.095942 INFO API is disabled
2018-04-03 20:53:04.098754 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1042, in create_server
    sock.bind(sa)
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/appdaemon", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 365, in main
    admain.main()
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 361, in main
    self.run(appdaemon, hadashboard)
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py", line 80, in run
    loop.run_until_complete(asyncio.gather(*pending))
  File "/usr/lib/python3.5/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1046, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5050): address already in use

please show what is in your appdaemon.yaml
i havent seen this error before, but first lets check if your configuration is alright.

Yes there is. The 8th line prepended with tcp6. Run the netstat-command with sudo in front so it shows which process that is.

1 Like

because off the great catch from @danielperna84 my guess is that in the appdaemon.yaml the same port is used for API and the dashboard.

Thanks, so here’s the content of the appdaemon.yaml first, I changed the port to 8890 last night just to be able to test it out:

appdaemon:
  disable_apps: true
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.1.106:8123
      ha_key: SecretPW
hadashboard:
  dash_url: http://192.168.1.106:8890
  dashboard_dir: /home/hass/.homeassistant/dashboards

and netstat:

tcp6       0      0 :::5050                 :::*                    LISTEN      1796/docker-proxy

So… listing the dockers I found

b98e15217704        appdaemon_dashboard   "/usr/bin/entry.sh..."   12 months ago       Up 20 hours                  0.0.0.0:5050->5050/tcp   appdaemon_dashboard

And apparently I tried installing it about a year ago but never got it working (nothing show up on :5050). Well deleted the docker container and volumes (had a hadashboard docker to), changed the port back to 5050 and then it worked!

pi@raspberrypi:~ $ sudo appdaemon -c /home/hass/.homeassistant/conf
2018-04-04 16:10:26.228671 INFO AppDaemon Version 3.0.0 starting
2018-04-04 16:10:26.229370 INFO Configuration read from: /home/hass/.homeassistant/conf/appdaemon.yaml
2018-04-04 16:10:26.231429 INFO AppDaemon: Apps are disabled
2018-04-04 16:10:26.232330 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-04-04 16:10:27.023126 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-04-04 16:10:27.024190 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-04-04 16:10:27.025020 INFO Starting Dashboards
2018-04-04 16:10:27.049636 INFO API is disabled
2018-04-04 16:10:27.074737 INFO AppDaemon: HASS: Connected to Home Assistant 0.66.1
2018-04-04 16:10:27.168210 INFO AppDaemon: Got initial state from namespace default

Case closed, thanks for the help @ReneTode & @danielperna84

1 Like