Homeassistant service failed

Homeassistant keeps failing in dietpi-services. Done reinstall of the software and clean install of dietpi

Required Information

  • DietPi version | 8.7
  • Distro version | bullseye
  • Kernel version | Linux DietPi 5.15.56-v8+
  • SBC model | RPi 4 Model B (aarch64)
  • Power supply used | Official pi charger 5v 3a
  • SD card used | Kingston A400 SSD

Additional Information (if applicable)

  • Software title | Home Assistant
  • Was the software title installed freshly or updated/migrated? Freshly installed
  • Can this issue be replicated on a fresh installation of DietPi? Yes
  • Bug report ID |

Steps to reproduce

  1. Install Home Assistant from dietpi-software
  2. run htop
  3. restart home assistant
  4. run htop

Expected behaviour

  • Home assistant accessible on local ip

Actual behaviour

  • Service keeps failing in dietpi-services and can’t reach it

Here’s the log from my home assistant installation

root@DietPi:~# journalctl -u home-assistant.service
-- Journal begins at Thu 2022-08-18 15:58:23 BST, ends at Thu 2022-08-18 16:27:39 BST. --
Aug 18 16:18:57 DietPi systemd[1]: Started Home Assistant (DietPi).
Aug 18 16:19:00 DietPi Home Assistant[15260]: 2022-08-18 16:19:00.422 ERROR (MainThread) [root] Uncaught exception
Aug 18 16:19:00 DietPi Home Assistant[15260]: Traceback (most recent call last):
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/bin/hass", line 8, in <module>
Aug 18 16:19:00 DietPi Home Assistant[15260]:     sys.exit(main())
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/__main__.py", line 191, in main
Aug 18 16:19:00 DietPi Home Assistant[15260]:     exit_code = runner.run(runtime_conf)
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/runner.py", line 119, in run
Aug 18 16:19:00 DietPi Home Assistant[15260]:     return loop.run_until_complete(setup_and_run_hass(runtime_config))
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
Aug 18 16:19:00 DietPi Home Assistant[15260]:     return future.result()
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/runner.py", line 101, in setup_and_run_hass
Aug 18 16:19:00 DietPi Home Assistant[15260]:     hass = await bootstrap.async_setup_hass(runtime_config)
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 143, in async_setup_hass
Aug 18 16:19:00 DietPi Home Assistant[15260]:     await async_from_config_dict(config_dict, hass) is not None
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 256, in async_from_config_dict
Aug 18 16:19:00 DietPi Home Assistant[15260]:     await _async_set_up_integrations(hass, config)
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 532, in _async_set_up_integrations
Aug 18 16:19:00 DietPi Home Assistant[15260]:     recorder.async_initialize_recorder(hass)
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/helpers/recorder.py", line 22, in async_initialize_recorder
Aug 18 16:19:00 DietPi Home Assistant[15260]:     from homeassistant.components.recorder import const, models
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/components/recorder/__init__.py", line 23, in <module>
Aug 18 16:19:00 DietPi Home Assistant[15260]:     from . import statistics, websocket_api
Aug 18 16:19:00 DietPi Home Assistant[15260]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/components/recorder/statistics.py", line 17, in <module>
Aug 18 16:19:00 DietPi Home Assistant[15260]:     from sqlalchemy import bindparam, func, lambda_stmt, select
Aug 18 16:19:00 DietPi Home Assistant[15260]: ModuleNotFoundError: No module named 'sqlalchemy'
Aug 18 16:19:00 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=1/FAILURE
Aug 18 16:19:00 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Aug 18 16:19:00 DietPi systemd[1]: home-assistant.service: Consumed 3.427s CPU time.
Aug 18 16:27:36 DietPi systemd[1]: Started Home Assistant (DietPi).
Aug 18 16:27:39 DietPi Home Assistant[15529]: 2022-08-18 16:27:39.178 ERROR (MainThread) [root] Uncaught exception
Aug 18 16:27:39 DietPi Home Assistant[15529]: Traceback (most recent call last):
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/bin/hass", line 8, in <module>
Aug 18 16:27:39 DietPi Home Assistant[15529]:     sys.exit(main())
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/__main__.py", line 191, in main
Aug 18 16:27:39 DietPi Home Assistant[15529]:     exit_code = runner.run(runtime_conf)
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/runner.py", line 119, in run
Aug 18 16:27:39 DietPi Home Assistant[15529]:     return loop.run_until_complete(setup_and_run_hass(runtime_config))
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
Aug 18 16:27:39 DietPi Home Assistant[15529]:     return future.result()
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/runner.py", line 101, in setup_and_run_hass
Aug 18 16:27:39 DietPi Home Assistant[15529]:     hass = await bootstrap.async_setup_hass(runtime_config)
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 143, in async_setup_hass
Aug 18 16:27:39 DietPi Home Assistant[15529]:     await async_from_config_dict(config_dict, hass) is not None
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 256, in async_from_config_dict
Aug 18 16:27:39 DietPi Home Assistant[15529]:     await _async_set_up_integrations(hass, config)
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/bootstrap.py", line 532, in _async_set_up_integrations
Aug 18 16:27:39 DietPi Home Assistant[15529]:     recorder.async_initialize_recorder(hass)
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/helpers/recorder.py", line 22, in async_initialize_recorder
Aug 18 16:27:39 DietPi Home Assistant[15529]:     from homeassistant.components.recorder import const, models
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/components/recorder/__init__.py", line 23, in <module>
Aug 18 16:27:39 DietPi Home Assistant[15529]:     from . import statistics, websocket_api
Aug 18 16:27:39 DietPi Home Assistant[15529]:   File "/home/homeassistant/.pyenv/versions/3.9.13/lib/python3.9/site-packages/homeassistant/components/recorder/statistics.py", line 17, in <module>
Aug 18 16:27:39 DietPi Home Assistant[15529]:     from sqlalchemy import bindparam, func, lambda_stmt, select
Aug 18 16:27:39 DietPi Home Assistant[15529]: ModuleNotFoundError: No module named 'sqlalchemy'
Aug 18 16:27:39 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=1/FAILURE
Aug 18 16:27:39 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Aug 18 16:27:39 DietPi systemd[1]: home-assistant.service: Consumed 3.432s CPU time.
root@DietPi:~#

We covered this some days ago, see:
Error while installing home assistant

2 Likes

Ohh. Thank you so much. I thought my hw was going down tbh :sweat_smile:

Edit: @Joulinar I tried the commands below but it didn’t work. I’ve hit my post limit so this was the only to message without creating a whole new thread.

not sure if already done, but workaround would be

sudo -u homeassistant bash
. /home/homeassistant/pyenv-activate.sh
pip3 install sqlalchemy

We’re checking the limits and in case set you a trust level up :smile:.

There is a second module required:

sudo -u homeassistant bash
. /home/homeassistant/pyenv-activate.sh
pip3 install sqlalchemy fnvhash
exit
systemctl restart home-assistant

If it still doesn’t work, can you please show the logs again:

journalctl -u home-assistant

Yes, you hit the maximum number of replies a user is allowed to create in the 24 hour period after creating their first post. I have doubled the value now :slight_smile:

2 Likes

That seems to have done it! Thank you very much!

A weird question now that I’m here, I’m currently booting of an ssd with an adapter that doesn’t support trim but I have one that supports trim on its way tomorrow. Is it fine to just switch the adapter and trim function would work?

Thank you very much :smile:

With “adapter” you mean “controller”?

You should be able to just clone the disk and boot from the new one without incidence. If it is larger, enable the following service first, to expand filesystem automatically on boot:

systemctl enable dietpi-fs_partition_resize

I hope it’s not smaller, that would make cloning more complicated: Running DietPi from an USB stick or an onboard eMMC

I’m not really familiar with the terms so apologies for that :sweat_smile:

It’s the same ssd drive but different usb to sata adapter.

Ah, this is what you mean, then the term is correct :slightly_smiling_face:.