Home Assistant not listening on port 8123

Hi guys,

I’m a bit lost here right now… I’ve installed Home Assistant using the venv method and it worked quite fine for I think two months now. Yesterday, I updated to the newest version, which also worked just fine.

Today however, I updated my systems dependencies using apt upgrade (running Ubuntu 18.04) and after a restart, my assistant just wouldn’t listen to Port 8123 anymore:

# netstat --tcp --listening --programs --numeric
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.13.100:51827    0.0.0.0:*               LISTEN      1170/python3
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1000/systemd-resolv
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1218/sshd
tcp        0      0 192.168.13.100:1400     0.0.0.0:*               LISTEN      1170/python3
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      1298/nginx: master
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1450/mysqld
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1298/nginx: master
tcp6       0      0 :::22                   :::*                    LISTEN      1218/sshd
tcp6       0      0 :::9000                 :::*                    LISTEN      1831/docker-proxy

However, the service starts up just fine:

# systemctl status home-assistant
● home-assistant.service - Home Assistant
   Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-11-28 10:15:07 UTC; 6min ago
 Main PID: 1170 (hass)
    Tasks: 37 (limit: 4474)
   CGroup: /system.slice/home-assistant.service
           └─1170 /home/homeassistant/bin/python3 /home/homeassistant/bin/hass -c /home/homeassistant/.homeassistant

Nov 28 10:15:16 timbl hass[1170]: IndexError: list index out of range
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 5.4 seconds.
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (SyncWorker_17) [homeassistant.components.device_tracker.fritz] Scanning
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.setup] Setting up ios
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.setup] Setup of domain ios took 0.0 seconds.
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.loader] Loaded sensor.ios from homeassistant.components.sensor.ios
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.loader] Loaded notify.ios from homeassistant.components.notify.ios
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ios
Nov 28 10:15:17 timbl hass[1170]: 2018-11-28 10:15:17 INFO (MainThread) [homeassistant.components.notify] Setting up notify.ios
Nov 28 10:15:21 timbl hass[1170]: 2018-11-28 10:15:21 ERROR (SyncWorker_18) [pychromecast.socket_client] Failed to connect, retrying in 5.0s

The log file also doesn’t contain anything unusual:

# cat .homeassistant/home-assistant.log
2018-11-28 10:15:10 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2018-11-28 10:15:11 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=45 from 2018-11-28 10:09:21)
2018-11-28 10:15:16 ERROR (Thread-8) [pychromecast.socket_client] Exception caught while sending message to controller ReceiverController: Message urn:x-cast:com.google.cast.receiver from receiver-0 to sender-0: {'requestId': 1, 'status': {'applications': [], 'isActiveInput': True, 'volume': {'controlType': 'attenuation', 'level': 1, 'muted': False, 'stepInterval': 0.05}}, 'type': 'RECEIVER_STATUS'}
Traceback (most recent call last):
  File "/home/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 460, in _route_message
    message, data)
  File "/home/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 775, in receive_message
    self._process_get_status(data)
  File "/home/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 905, in _process_get_status
    status = self._parse_status(data, self.cast_type)
  File "/home/homeassistant/lib/python3.6/site-packages/pychromecast/socket_client.py", line 883, in _parse_status
    app_data = data['applications'][0]
IndexError: list index out of range
2018-11-28 10:15:21 ERROR (SyncWorker_18) [pychromecast.socket_client] Failed to connect, retrying in 5.0s

I’ve tried tinkering with the configuration, but no luck so far. I started out with just the base_url (which worked fine before, I’m using an nginx proxy). Then I tried adding server_port and server_host, but there seems to be no difference whatsoever:

http:
  base_url: some.external.domain
  api_password: [...]
  server_port: 8123
  server_host: '127.0.0.1'

Any help is really appreciated!

Thanks

WiFiCable

Based on your small sample of logs here, it looks like your python isn’t able to get a network connection on your LAN. Check your firewalld settings and/or SELinux settings.

Thanks for your reply. I’ve stopped the ufw service and disabled apparmor, but it still won’t listen to the given port. However, I now get a few more entries in the log file, which looks quite good, since this seems to be normal behaviour:

2018-11-28 12:00:28 ERROR (MainThread) [homeassistant.components.sensor] deutsche_bahn: Error on device update!
Traceback (most recent call last):
  File "/home/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 251, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/home/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/homeassistant/components/sensor/deutsche_bahn.py", line 82, in update
    self.data.update()
  File "/home/homeassistant/lib/python3.6/site-packages/homeassistant/components/sensor/deutsche_bahn.py", line 105, in update
    self.only_direct)
  File "/home/homeassistant/lib/python3.6/site-packages/schiene/schiene.py", line 135, in connections
    return parse_connections(rsp.text)
  File "/home/homeassistant/lib/python3.6/site-packages/schiene/schiene.py", line 35, in parse_connections
    data = parse_delay(data)
  File "/home/homeassistant/lib/python3.6/site-packages/schiene/schiene.py", line 65, in parse_delay
    delay_arrival_raw = soup.find('div', class_="routeEnd").find('span', class_=["delay", "delayOnTime"])
AttributeError: 'NoneType' object has no attribute 'find'
2018-11-28 12:00:36 ERROR (SyncWorker_11) [pychromecast.socket_client] Failed to connect, retrying in 5.0s

EDIT: I noticed that it isn’t logging anything to the database except for the recorder_runs entry. Everything else (events and states) hasn’t changed. Maybe it gets stuck before getting to that part?

So, that was a hard one… turns out it really just stops starting up until that chromecast thing times out. But it doesn’t, so it just stays there forever. This gave me the hint: https://github.com/home-assistant/home-assistant/issues/14956

And after applying this fix locally, everything is working again: https://github.com/home-assistant/home-assistant/pull/16471/files