Home Assistant keeps crashing when run as systemctl service

Yesterday, I discovered why all my devices where acting strange, Home Assistant restarted every minute or so, without any notices or errors.

I checked the logs and nothing fatal showed up, except for ERROR (updater) [telegram.ext.updater] home assistant.

After a while the logs showed the client disconnected message and then hass got restarted, clearing the logs.

The strange thing is, that when I try to stop hass from restarting a crashed Home Assistant instance, it wouldn’t allow me to do so, so I had to use some brute force (sudo killall hass) to kill all Home Assistant instanced (since there were multiple running somehow).

When I dropped into the shell as the homeassistant user and I executed /srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" everything was fine, and the server has been running non-stop for 10 hours straight.

When I try to start Home Assistant with systemctl start [email protected], it keeps rebooting and not telling why.

I am running custom components (Toon components from https://github.com/cyberjunky/home-assistant-custom-components) but they are all working as they should.

I did get a few database locked warning, but they are gone too, since I removed (renamed) the database file.

Any ideas why Home Assistant keeps crashing when it’s started by systemctl and not when it’s started with the exact same command line?

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

[Unit]
Description=Home Assistant
After=network.target

[Service]
Type=simple
User=homeassistant
ExecStart=/srv/homeassistant/bin/hass -v -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target

I am running Home Assistant on Ubuntu 16.04.6 Server LTS with an Intel® Core™ i5 CPU 750 @ 2.67GHz (quad core) with around 10GB’s of system ram.

Home Assistant has been running smoothly for around a year now.

I am not sure what the -v option does, but it is not the same as the -c in your working example. I don’t have any parameters in the exec line of my .service file, and it still picks up the configuration file from this directory.

The -v option prints out verbose data, but I’m not sure why the -c is not there as it was there before.

It was there during the crash loop though

EDIT: I stopped the Home Assistant instance that I was running manually from the shell and restarted the systemd service through systemctl and it is up for 1h and 20 minutes now so it seems to be alright.