Home Assistant fails to start

First time for me.

Restarted Home Assistant as a result of changes to a lovelace dashboard and now it doesn’t start anymore. With this I mean I can’t access the system via the browser <IP>:8123

I’m running the latest versions (OS, Supervisor, Core) on a VirtualBox (6.1.16) running on Fedora 31.

I can access /config via Samba. This is what’s in /config/home-assistant.log

2021-04-12 23:26:05 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/scripts.yaml contains duplicate key "service". Check lines 7 and 11
2021-04-12 23:26:05 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/scripts.yaml contains duplicate key "data". Check lines 8 and 12
2021-04-12 23:26:05 WARNING (MainThread) [homeassistant.loader] You are using a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-04-12 23:26:05 WARNING (MainThread) [homeassistant.loader] You are using a custom integration browser_mod which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-04-12 23:26:06 WARNING (MainThread) [homeassistant.components.http] The 'base_url' option near /config/configuration.yaml:85 is deprecated, please remove it from your configuration
2021-04-12 23:26:06 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
2021-04-12 23:26:16 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2021-04-12 23:26:20 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=108 from 2021-04-12 13:24:31.709169)
2021-04-12 23:26:21 WARNING (MainThread) [homeassistant.loader] You are using a custom integration wyzesense which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-04-12 23:26:21 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'wyzesense'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'wyzesense'
2021-04-12 23:26:21 WARNING (MainThread) [homeassistant.loader] You are using a custom integration energyeasy which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-04-12 23:26:21 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'energyeasy'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'energyeasy'
2021-04-12 23:26:24 ERROR (MainThread) [elkm1_lib.elk] Invalid message '00C2'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/elkm1_lib/elk.py", line 139, in _got_data
    self._message_decode.decode(data)
  File "/usr/local/lib/python3.8/site-packages/elkm1_lib/message.py", line 79, in decode
    raise ValueError(error_msg)
ValueError: Incorrect message length
2021-04-12 23:26:24 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up energyeasy platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/energyeasy/sensor.py", line 156, in setup_platform
    sensors.append(EnergyEasySensor(energyeasy_data, variable, name))
  File "/config/custom_components/energyeasy/sensor.py", line 180, in __init__
    self._state = round(self.energyeasy_data.data[self.type], 2)
TypeError: type NoneType doesn't define __round__ method

What seems concerning is the message whether home-assistant_v2.db has been shutdown properly. It’s size is 616MB and counting even though I no longer have access. There are some integrations (wyzesense, energyeasy) which don’t seem to be supported anymore but this shouldn’t stop a system from booting up.

I have access to HA from the VirtualBox terminal. Logged in via ‘root’ and did a ha> core check which threw an error. Tried a ha> core rebuild which finished successful, core check still with errors.

I have reported earlier that the system was progressively getting slower - something hard to believe given I’m running 20GB Ram on a Dell OptiPlex 950. So it may be I have run out of resources somewhere (log file(s) etc.)

I’m tapping in the dark here. What’s the best way to recover this?

You also have invalid scripts:

2021-04-12 23:26:05 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/scripts.yaml contains duplicate key "service". Check lines 7 and 11
2021-04-12 23:26:05 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/scripts.yaml contains duplicate key "data". Check lines 8 and 12

The recorder unfinished sessions and not shutdown cleanly is a result of not shutting down HA. This could have been cycling power, sending a system reboot command, etc. I get it using HA container whenever I restart the container, not from the frontend.

Temporarily remove the two custom components, fix your script warnings and see if it boots properly. A 616Mb database is small. I hover around 7.8Gb with 28 days of data and don’t have a performance slow down.

I have seen this before - been there for about a week - but it didn’t stop it from starting. As a test I have removed that part of the script with the same result

Ok will try that and get back.

Ok here’s some update…

Waking up I realised the automations still worked. So I thought this must be related to the front end. After all I could access /config via the Samba share. I have disabled the integrations (energyeasy and wyzesense) as well as the script errors. Restarted and tried to logon. Same error.

I’m using DuckDNS but tried the login via the IP address and it worked. Brought back all the non-working integrations and scripts and it still works via the IP address.

So the issue must be in relation to DuckDNS. Given this post was about Home Assistant failing to start I have created a new post as this is another issue.