"Error during setup of component http" [raspbian| autostart | systemd]

Manual starting working but autostart using systemd raise error.

cat /etc/systemd/system/[email protected]

[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/homeassistant/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target

HA worked correctly if I run it manually:

sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
cd ~/.homeassistant
hass

but only autostart raise error that start from:

First part of error traceback:

Dec 26 21:58:10 raspberrypi hass[413]: 2021-12-26 21:58:10 ERROR (MainThread) [homeassistant.setup] Error during setup of component http
Dec 26 21:58:10 raspberrypi hass[413]: Traceback (most recent call last):
Dec 26 21:58:10 raspberrypi hass[413]:   File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 229, in _async_setup_component
Dec 26 21:58:10 raspberrypi hass[413]:     result = await task
Dec 26 21:58:10 raspberrypi hass[413]:   File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/__init__.py", line 192, in async_setup
Dec 26 21:58:10 raspberrypi hass[413]:     local_ip = await async_get_source_ip(hass)
Dec 26 21:58:10 raspberrypi hass[413]:   File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/network/__init__.py", line 35, in async_get_source_ip
Dec 26 21:58:10 raspberrypi hass[413]:     return source_ip if source_ip in all_ipv4s else all_ipv4s[0]
Dec 26 21:58:10 raspberrypi hass[413]: IndexError: list index out of range

If I restart HA manually it start working fine.

sudo systemctl restart home-assistant@homeassistant

But I need to run it automatically from raspbian startup

Prerequisites:

  • Raspberry Pi4 mode B (8gb) + Argon ONE M.2 case
  • Raspbian GNU/Linux 11 (bullseye)
  • HomeAssistant 2021.12.5 (core installed)

I think you must specify user for running systemd service.
Here is mine, working config:
igor@hass:~$ cat /etc/systemd/system/[email protected]
[Unit]
Description=Home Assistant
After=network-online.target

After=zigbee2mqtt.service

[Service]
Type=simple
User=%i
ExecStartPre=/bin/sleep 60
ExecStart=/srv/homeassistant/bin/hass -c “/home/%i/.homeassistant”
Restart=always

[Install]
WantedBy=multi-user.targe

User=%i
this is just a variable
same that used in next line

ExecStart=/srv/homeassistant/bin/hass -c “/home/%i/.homeassistant”

but behaviour is the same.
During spending a lot of time trying to fix it I found that it’s imposible to combine supervisor & add-ons in core version.
So I reintall system.
Probably the issue present in fresh updates and still not fixed because I found few more articles but with pure description of problem.

I’m having the same issue. Seems to have started with 2021.12
Have you found a fix or any more information?

I decided to change installation type to docker containers. Because it more stable and it much more easy to install )))