Upgraded and now get 404 not found

Having been notified that there was an upgrade to HA, on several occasions but never having been able to upgrade due to various errors, I finally decided to get the upgrade done once and for all.

I managed this by doing a deinstall and then an install.

Once this had completed I was able to get the ui running, at least in a terminal window, but in my browser I get “404 not found”.

Here’s the log which seems to show a multitude of errors, and I’m not sure which are fatal and which can be ignored for now:

2018-08-27 18:51:43 ERROR (SyncWorker_0) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/configuration.yaml contains duplicate key "config". Check lines 22 and 67.
2018-08-27 18:51:43 ERROR (SyncWorker_0) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/configuration.yaml contains duplicate key "automation". Check lines 70 and 193.
2018-08-27 18:51:43 WARNING (MainThread) [homeassistant.components.http] You have been advised to set http.api_password.
2018-08-27 18:51:43 ERROR (MainThread) [homeassistant.setup] Error during setup of component auth
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/setup.py", line 145, in _async_setup_component
    hass, processed_config)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/auth/__init__.py", line 78, in async_setup
    hass.http.register_view(GrantTokenView(retrieve_credentials))
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/http/__init__.py", line 259, in register_view
    view.register(self.app, self.app.router)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/http/view.py", line 86, in register
    app['allow_cors'](route)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/http/cors.py", line 50, in <lambda>
    allow_methods='*',
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/http/cors.py", line 39, in _allow_cors
    path = path.canonical
AttributeError: 'PlainResource' object has no attribute 'canonical'
2018-08-27 18:51:43 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of frontend. Setup failed for dependencies: auth
2018-08-27 18:51:43 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not setup all dependencies.
2018-08-27 18:51:43 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of logbook. Setup failed for dependencies: frontend
2018-08-27 18:51:43 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not setup all dependencies.
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Error during setup of component tuya
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/setup.py", line 148, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/tuya.py", line 59, in setup
    username = config[DOMAIN][CONF_USERNAME]
KeyError: 'tuya'
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of light.tuya. Setup failed for dependencies: tuya
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform light.tuya: Could not setup all dependencies.
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of light.tuya. Setup failed for dependencies: tuya
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform light.tuya: Could not setup all dependencies.
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of light.tuya. Setup failed for dependencies: tuya
2018-08-27 18:51:45 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform light.tuya: Could not setup all dependencies.
2018-08-27 18:52:06 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform plex
Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f942a724828>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.2', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f942a724828>: Failed to establish a new connection: [Errno 113] No route to host',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/media_player/plex.py", line 101, in setup_platform
    hass, config, add_devices_callback
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/media_player/plex.py", line 120, in setup_plexserver
    token, cert_session
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/plexapi/server.py", line 102, in __init__
    data = self.query(self.key, timeout=timeout)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/plexapi/server.py", line 341, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.2', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f942a724828>: Failed to establish a new connection: [Errno 113] No route to host',))
2018-08-27 18:52:06 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform plex
Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f942a718518>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/homeassistant/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.2', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f942a718518>: Failed to establish a new connection: [Errno 113] No route to host',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/media_player/plex.py", line 101, in setup_platform
    hass, config, add_devices_callback
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/media_player/plex.py", line 120, in setup_plexserver
    token, cert_session
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/plexapi/server.py", line 102, in __init__
    data = self.query(self.key, timeout=timeout)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/plexapi/server.py", line 341, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/homeassistant/.local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.2', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f942a718518>: Failed to establish a new connection: [Errno 113] No route to host',))

On the off-chance it was something in my config, I emptied and restarted. I now get this when I try staring the ui, then nothing

2018-08-27 19:21:56 INFO (MainThread) [homeassistant.core] Timer:starting

If you have an empty config file, that is probably the correct output. I think the way to proceed is to delete all the config files so that HA will re-create the default configuration when it starts.

You can then add your old configuration back one section at a time from your backup (which I hope you took), and fix the things that are now broken.

You need clean your config/deps folder. There were some outdated aiohttp lib blocked frontend loading.

I ended up rebuilding the machine, then upgrading to Ubuntu 18.04 to get the Python version I needed.

However, I have now gone full circle as when I try to install homeassistant, I get an error regarding not being able to import main from pip or something like that. This was the error I was getting right back at the start when I tried to perform the homeassistant upgrade.
sigh

Try to clean your config/.local folder if it exists. On my raspberry there were also installed some python packages in this folder which led to compatibility issues. Some modules could not be started during home assistant startup.
So I got the 404 not found error. After cleaning the config/.local folder and config/deps folder Home Assistant starts without an module error. I can open the Webgiu as normal.