I have setup Home Assistant in a virtualenv on my Ubuntu 16.04 and it starts by hand without any problems. I’m now trying to setup the autostart on my computer using instructions for systemd but I encounter an error at the end:
root@serveur:/etc/systemd/system# systemctl enable home-assistant@homeassistant
Failed to execute operation: No such file or directory
root@serveur:/etc/systemd/system#
Not sure how to check what’s wrong here I double checked all steps and I don’t think I made a mistake but it still doesn’t work
root@serveur:/home/homeassistant/.homeassistant# ls -l /lib/systemd/system/home-assistant.service
-rw-r–r-- 1 root root 202 mars 31 14:22 /lib/systemd/system/home-assistant.service
root@serveur:/home/homeassistant/.homeassistant#
but still same error
root@serveur:/home/homeassistant/.homeassistant# systemctl enable home-assistant
Failed to execute operation: Too many levels of symbolic links
root@serveur:/home/homeassistant/.homeassistant#
A quick Google suggests that systemd sometimes has issues with links. Maybe remove the link from /etc/systemd/system and copy the file from /lib/systemd/system/ to that directory? Then run systemctl daemon-reload and try again.
Thanks but when I try then to start it it tells me (completely lost here
root@serveur:/etc/systemd/system/multi-user.target.wants# service home-assistant.service start
Failed to start home-assistant.service.service: Unit home-assistant.service.service not found.
root@serveur:/etc/systemd/system/multi-user.target.wants#
I know this process does the same thing by letting systemctl remove the link and recreate it. Not sure how or why it had the link the first time but wasn’t starting, but this seemed to reset everything.
I believe the issue is that the docs (https://home-assistant.io/docs/autostart/systemd/) tell you to create both /lib/systemd/system/home-assistant.service and the symlink /etc/systemd/system/home-assistant.service. Really you should only create the first one, and systemd will make the symlink for you when the service is enabled.