Cannot get hass service to work (linux / systemd)

I have a Raspberry Pi 3 that will be dedicated to HomeAssistant. However, for fun, I decided to install Raspbian on the device, then install HomeAssistant on top of that. I followed the instructions here (without creating a separate user/group), but ran into a problem when runnign hass for the first time. The problem was resolved by opening up file permissions …/hass_venv/lib/python3.4/site-packages.

I then followed the instructions here configure the system so that hass would run, and autorun, as a service. I again ran into problems.

I believe that the service file is correct (note - I am lazy and typically operate using sudo -s, thus no sudo before each command):

[email protected]:/etc/systemd/system# cat [email protected]
Description=Home Assistant

ExecStart=/home/pi/homeassistant/bin/hass -c “/home/pi/.homeassistant”


Next, I executed the commands shown:

[email protected]:/etc/systemd/system# systemctl --system daemon-reload
[email protected]:/etc/systemd/system# systemctl enable [email protected]
Created symlink /etc/systemd/system/[email protected] → /etc/systemd/system/[email protected]
[email protected]:/etc/systemd/system# systemctl start [email protected]
Failed to get properties: Unit name [email protected] is missing the instance name.
See system logs and ‘systemctl status [email protected]’ for details.

When I looked in the various log files for details, I found nothing useful (only relevant lines are shown):

[email protected]:/var/log# tail -50 daemon.log
Nov 27 23:12:26 podhomeauto systemd[1]: Reloading.
Nov 27 23:12:38 podhomeauto systemd[1]: Reloading.
[email protected]:/var/log# ls -al

[email protected]:/var/log# tail -50 syslog
Nov 27 23:12:26 podhomeauto systemd[1]: Reloading.
Nov 27 23:12:38 podhomeauto systemd[1]: Reloading.

The file permissions seem to be set correctly (because they are the same as the one other service file in the folder) (only two files are shown):

[email protected]:/etc/systemd/system# ls -al
total 76
drwxr-xr-x 17 root root 4096 Nov 27 23:04 .
drwxr-xr-x 5 root root 4096 Sep 7 10:47 …
-rw-r–r-- 1 root root 1551 Aug 11 09:40 [email protected]
-rw-r–r-- 1 root root 199 Nov 27 23:04 [email protected]

Would you please help me try to resolve this problem?

 ExecStart=/home/pi/homeassistant/bin/hass -c “/home/pi/.homeassistant”

This line refers to a binary file in the pi user directory.

You need the service file for the virtual environment, its the second section on the systemd page.


Thanks you for the reply, but I am not understanding…

I created the service file as per the instructions. I modified it such that the target of ExecStart is the binary file - I double-checked its location. The hass executable is in /home/pi/homeassistant/bin/hass, not /usr/bin.

Would you kindly offer some specific suggestions for me to try?

Weird - I just tried again and it worked. I made no changes, other than a) the system had been power-cycled and b) I ran the command via ssh instead of the terminal.

Let’s mark this up as resolved, though I have no idea why…

I have just realized (from answering another post), that the page I linked to has been changed. You followed the instructions from the first part, which I didn’t know existed. So, your service file is fine.

As to why it didn’t work, you do have to do sudo systemctl daemon-reload when you add a new service file, which may have been the problem. I’m not sure if the system does that automatically on a reboot, but from your experience it may well do.