HA cannot be restarted from UI

Hi,

I had a problem recently whereby I was unable to restart HA from the UI. HA just stops and I have to ssh in and restart with systemctl restart home-assistant.

I tried a bunch of things to address this, but nothing worked so I made a completely fresh install of both HA and DietPi and I still have the problem.

I am not sure, therefore, whether this is a problem with HA 2022.2 which I recently upgrades or DietPi from apt update or something else.

Has anyone else noticed this problem?

I don’t have an answer on your question bu first thing would be to have a look into service status and log file

systemctl status home-assistant
journalctl -u home-assistant

Thanks.

there are some HA log entries to do with ffmpeg (below) but nothing that I can see wrt not restarting.

How do I check the service status? htop simply shows that HA isn’t running.

cheers!

  File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/haffmpeg/core.py", line 136, in open
    self._proc = await self._loop.run_in_executor(None, proc_func)
  File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
2022-02-04 18:09:00 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.

once you hit the restart button, the service status can be checked using

systemctl status home-assistant

cheers.

When it is running, I get this:

● home-assistant.service - Home Assistant (DietPi)
     Loaded: loaded (/etc/systemd/system/home-assistant.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-02-04 18:28:54 GMT; 32s ago
   Main PID: 64734 (hass)
      Tasks: 12 (limit: 2198)
        CPU: 23.172s
     CGroup: /system.slice/home-assistant.service
             └─64734 /home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9 /home/homeassistant/.pyenv/versions/3.9.9/bin/hass -c /mnt/dietpi_userdata/homeassistant

Feb 04 18:29:15 DietPi homeassistant[64734]:   File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/haffmpeg/core.py", line 136, in open
Feb 04 18:29:15 DietPi homeassistant[64734]:     self._proc = await self._loop.run_in_executor(None, proc_func)
Feb 04 18:29:15 DietPi homeassistant[64734]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Feb 04 18:29:15 DietPi homeassistant[64734]:     result = self.fn(*self.args, **self.kwargs)
Feb 04 18:29:15 DietPi homeassistant[64734]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/subprocess.py", line 951, in __init__
Feb 04 18:29:15 DietPi homeassistant[64734]:     self._execute_child(args, executable, preexec_fn, close_fds,
Feb 04 18:29:15 DietPi homeassistant[64734]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
Feb 04 18:29:15 DietPi homeassistant[64734]:     raise child_exception_type(errno_num, err_msg, err_filename)
Feb 04 18:29:15 DietPi homeassistant[64734]: FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
Feb 04 18:29:15 DietPi homeassistant[64734]: 2022-02-04 18:29:15 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.

After I restart, I get this:

● home-assistant.service - Home Assistant (DietPi)
     Loaded: loaded (/etc/systemd/system/home-assistant.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-02-04 18:30:27 GMT; 3s ago
    Process: 64734 ExecStart=/home/homeassistant/homeassistant-start.sh (code=exited, status=100)
   Main PID: 64734 (code=exited, status=100)
        CPU: 29.994s

Feb 04 18:30:25 DietPi homeassistant[64734]:                                                                     <traceback object at 0x7f6f332580>)}
Feb 04 18:30:25 DietPi homeassistant[64734]: {'Corrupt packet received while decoding name from {self.source}': (<class 'zeroconf._exceptions.IncomingDecodeError'>,
Feb 04 18:30:25 DietPi homeassistant[64734]:                                                                     IncomingDecodeError('Corrupt packet received while decoding name from {self.source}'),
Feb 04 18:30:25 DietPi homeassistant[64734]:                                                                     <traceback object at 0x7f6f332580>)}
Feb 04 18:30:25 DietPi homeassistant[64734]: {'Corrupt packet received while decoding name from {self.source}': (<class 'zeroconf._exceptions.IncomingDecodeError'>,
Feb 04 18:30:25 DietPi homeassistant[64734]:                                                                     IncomingDecodeError('Corrupt packet received while decoding name from {self.source}'),
Feb 04 18:30:25 DietPi homeassistant[64734]:                                                                     <traceback object at 0x7f6f332580>)}
Feb 04 18:30:27 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=100/n/a
Feb 04 18:30:27 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Feb 04 18:30:27 DietPi systemd[1]: home-assistant.service: Consumed 29.994s CPU time.

systemctl restart home-assistant always works.

can you do following, reboot your system first. Got to HA and try to restart application. Once done, collect the entire log file and share it

systemctl status home-assistant
journalctl -u home-assistant

sure - but to check, do you want me to delete the log file before restarting (so you haven’t got dross in it)? Also, do Hou want me to use the journalctl command you posted?

logs will be cleared automatically on reboot. That’s why I ask to do so. Once restarted HA, execute both commands pls.

OK,

systemctl status home-assistant gives:

home-assistant.service - Home Assistant (DietPi)
     Loaded: loaded (/etc/systemd/system/home-assistant.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-02-04 18:42:32 GMT; 6min ago
   Main PID: 65512 (hass)
      Tasks: 16 (limit: 2198)
        CPU: 43.362s
     CGroup: /system.slice/home-assistant.service
             └─65512 /home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9 /home/homeassistant/.pyenv/versions/3.9.9/bin/hass -c /mnt/dietpi_userdata/homeassistant

Feb 04 18:46:56 DietPi homeassistant[65512]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
Feb 04 18:46:56 DietPi homeassistant[65512]:     entry = entity_registry.async_get_or_create(
Feb 04 18:46:56 DietPi homeassistant[65512]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/helpers/entity_registry.py", line 401, in async_get_or_create
Feb 04 18:46:56 DietPi homeassistant[65512]:     entity_category=_convert_to_entity_category(entity_category),
Feb 04 18:46:56 DietPi homeassistant[65512]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/helpers/entity_registry.py", line 103, in _convert_to_entity_category
Feb 04 18:46:56 DietPi homeassistant[65512]:     return convert_to_entity_category(value, raise_report=raise_report)
Feb 04 18:46:56 DietPi homeassistant[65512]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 214, in convert_to_entity_category
Feb 04 18:46:56 DietPi homeassistant[65512]:     report(
Feb 04 18:46:56 DietPi homeassistant[65512]:   File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/helpers/frame.py", line 74, in report
Feb 04 18:46:56 DietPi homeassistant[65512]:     _LOGGER.warning(msg, stack_info=True)

and, journalctl -u home-assistant is huge, so put it in a file but that’s also too huge to post.

I could provide a cloud storage link where you could upload the file if you are ok

But at least the service seems to be active and not in failed status. Did you restart HA from GUI already?

sorry - forgot to do that.

I am OK with the cloud storage link and I appreciate your help in all this. I will need to do that for the log files as well.

https://magentacloud.de/s/p2wXGCgk9yMEj4m

I don’t have permission to upload.

Sorry was read only. Should be working now

https://magentacloud.de/s/p2wXGCgk9yMEj4m

done and thanks.

It’s late here so grabbing something to eat.

what time you restart your device? Because the console.log contains 3 hours of log.

There seems to be an issue with

[haffmpeg.core] FFmpeg fails [Errno 2] No such file or directory: 'ffmpeg'

and something with a template you are running. This seems to fill the log most

[homeassistant.helpers.template] Template warning:

You should try ti fix this first to get a better view on what’s going on.

Thanks.

It was a brand new install from scratch. I literally flashed the SD card, started DietPi and installed HA.

edit: should add I am referring to the ffmpeg issue. The template tis me just messing about re-installing things as it was a brand new flashed SD.

on the initial post you stated about an upgrade of HA. But how does it fit if this was a brand new install? Usually all packages should be up-to-date on a fresh install :thinking:

I got the problem on or around upgrading to HA 2020.2. I tried to restore to an older version but the restore failed.

I therefore decided to try a complete fresh install but the problem persisted.

I then started this thread.

I can only assume this is a problem in HA 2022.2 or a conflict between HA 2022.2 and DietPi.

what system you are running? Probably I could try to replicate

Required Information

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • Kernel version | uname -a
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)