Issue with setup of Autostart on Ubuntu 16.04!

Hi

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 :frowning: I double checked all steps and I don’t think I made a mistake but it still doesn’t work :frowning:

Thanks

Vincèn

What does ls -l /etc/systemd/system/home-assistant* show?

1 Like
root@serveur:/home/homeassistant/.homeassistant# ls -l /etc/systemd/system/home-assistant*
lrwxrwxrwx 1 root root 42 mars  31 14:23 /etc/systemd/system/home-assistant.service -> /lib/systemd/system/home-assistant.service
root@serveur:/home/homeassistant/.homeassistant# 

Does it help ? Thanks :wink:

Ok, so you’ve got a service file, that’s good.

What about:

ls -l /lib/systemd/system/home-assistant.service
sudo systemctl enable home-assistant

here are results:

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 :frowning:

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.

1 Like

Thanks but when I try then to start it it tells me (completely lost here :frowning:

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#

Try

systemctl start home-assistant
1 Like

Thanks, problem solved :+1:

I had this exact problem. I could manually start the service after boot with the start command, but it did not start on boot. Solved with:

sudo systemctl disable home-assistant
sudo systemctl enable home-assistant

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.