Unable to connect to Home Assistant on Virtual Machine

Hi all,
it seems I have a big problem.
My HA is running on a Synology Virtual Machine for many months without any problem.
But in the last few days I have problem to connect with the following persisting message.

The only solution is to stop the Virtual Machine and to restart it.

The connection to Home Assistant will be restblished but only after many minutes, up to 30-40 min.
At this point the situation seems stable with HA working correctly for few hours until he will “crush” again and I have to repeat the procedure (stop/restart the VM)…
Below a small part of the log file I have downloaded just after a restarting of HA.

  File "/usr/src/homeassistant/homeassistant/components/rpi_power/__init__.py", line 12, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2237, in async_forward_entry_setups
    await integration.async_get_platforms(platforms)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1181, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1151, in async_get_platforms
    await self.hass.async_add_import_executor_job(
asyncio.exceptions.CancelledError: Global task timeoute[0m
e[31m2024-11-08 21:46:44.946 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Google Translate text-to-speech for google_translate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/google_translate/__init__.py", line 14, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2237, in async_forward_entry_setups
    await integration.async_get_platforms(platforms)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1181, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1151, in async_get_platforms
    await self.hass.async_add_import_executor_job(
asyncio.exceptions.CancelledError: Global task timeoute[0m
e[33m2024-11-08 21:46:45.097 WARNING (ImportExecutor_0) [homeassistant.core] Config was used from pyscript, this is a deprecated alias which will be removed in HA Core 2025.11. Use homeassistant.core_config.Config instead, please report it to the author of the 'pyscript' custom integratione[0m
e[31m2024-11-08 21:46:44.988 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] (Region: Europe) for mbapi2020
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/__init__.py", line 71, in async_setup_entry
    masterdata = await coordinator.client.webapi.get_user_info()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/webapi.py", line 135, in get_user_info
    return await self._request("get", "/v2/vehicles")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/webapi.py", line 103, in _request
    async with self._session.request(method, url, **kwargs) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1359, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 663, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 563, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1032, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1317, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 971, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeoute[0m
e[33m2024-11-08 21:46:45.460 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 waiting on {<Task pending name='Task-220' coro=<_async_process_integration_platforms() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:243> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-2357' coro=<_async_process_integration_platforms() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:243> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-221' coro=<_async_process_integration_platforms() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:243> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-2510' coro=<async_setup_legacy.<locals>.async_setup_platform() running at /usr/src/homeassistant/homeassistant/components/tts/legacy.py:120> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-222' coro=<_async_process_integration_platforms() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:243> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-2515' coro=<_async_process_integration_platforms_for_component() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:108> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='platform loaded sensor' coro=<EntityComponent._async_component_platform_discovered() running at /usr/src/homeassistant/homeassistant/helpers/entity_component.py:166> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-2516' coro=<ConfigEntries.async_forward_entry_setup() running at /usr/src/homeassistant/homeassistant/config_entries.py:2308> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='platform loaded tts' coro=<async_setup_legacy.<locals>.async_platform_discovered() running at /usr/src/homeassistant/homeassistant/components/tts/legacy.py:195> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='Task-2514' coro=<_async_process_integration_platforms() running at /usr/src/homeassistant/homeassistant/helpers/integration_platform.py:243> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.12/asyncio/futures.py:387, Task.task_wakeup()]> cb=[set.remove()]>} - moving forwarde[0m
e[31m2024-11-08 21:46:57.740 ERROR (MainThread) [homeassistant.components.google_cloud.tts] File /config/googlecloud.json doesn't existe[0m
e[31m2024-11-08 21:46:57.740 ERROR (MainThread) [homeassistant.components.tts.legacy] Error setting up platform: google_cloude[0m
e[31m2024-11-08 21:47:06.725 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (((states.sensor.myenergi_casa_giu_green_consumed_today.state|float(default=0)) / (states.sensor.myenergi_casa_giu_consumed_today.state|float(default=0))*100)) | round(0, default=0) }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 633, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2735, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

Thanks for you help!

It dropped again this morning after circa 12 hours of normal working

Hi all,
today the same problem. Every fay I have to shutdown the VM and restart it.
Any help?

Hi Solarflor,

Look here…

Hi Sir_Goodenough,
not sure I have understood.
For which integration should I Enable Debug Logging?
Thanks

I have now added it in my configuration yaml

homeassistant:
  debug: true

This is what I found on Supervisor logfile

future: <Task finished name='Task-13586' coro=<Addon.watchdog_container() done, defined at /usr/src/supervisor/supervisor/addons/addon.py:1491> exception=AddonsJobError('Rate limit exceeded, more than 10 calls in 0:30:00')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1505, in watchdog_container
    await self._restart_after_problem(event.state)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 291, in wrapper
    raise on_condition(
supervisor.exceptions.AddonsJobError: Rate limit exceeded, more than 10 calls in 0:30:00
2024-11-11 15:13:32.945 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-13840' coro=<Addon.watchdog_container() done, defined at /usr/src/supervisor/supervisor/addons/addon.py:1491> exception=AddonsJobError('Rate limit exceeded, more than 10 calls in 0:30:00')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1505, in watchdog_container
    await self._restart_after_problem(event.state)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 291, in wrapper
    raise on_condition(
supervisor.exceptions.AddonsJobError: Rate limit exceeded, more than 10 calls in 0:30:00

after this a message like “Impossible to see supervisor registers , network error” but I can still access to HA.
I’m lost

Look at the data and figure out what custom_integration or add-on might be causing it and shut those down.

1 Like

I have removed SAMBA Backup that was giving an error and so far so good.
The system is stable since yesterday morning although I still have these errors in Supervisor

2024-11-12 11:02:03.839 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/DS720_1/0e86fb4f.tar: "filename './backup.json' not found"

2024-11-12 11:02:06.292 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/DS720_1/df9e042c.tar: empty file
1 Like