Autostart for manual installation method (Virtual Environment)


I’ve got Home Assistant up and running on my Raspberry Pi 2 using the manual installation method (, but I cannot get any of the autostart-versions to work, since the instructions are not written for the Virtual Environment-installation.

Does anyone know how to get this working with init.d?

Kind Regards

You should be using systemd on a raspberry Pi 2. Create this file as root user
(remove influxdb and mosquitto if you don’t use them)

$ cat /etc/systemd/system/[email protected]
# This is a simple service file for systems with systemd to tun HA as user.
# For details please check
Description=Home Assistant for %i mosquitto.service influxdb.service



and on the command line do

sudo systemctl start [email protected]
sudo systemctl enable [email protected]

I’ve created the file and removed the
mosquitto.service influxdb.service part.

However when I run
sudo systemctl start [email protected] it says

Failed to start [email protected]: Unit [email protected] failed to load: No such file or directory.

Isn’t the folder /srv/homeassistant/bin/hass the wrong one when HA has been installed in a virtual environment?

Sorry, my mistake. I copied the wrong line from my history. That was trying to start appdaemon.

To start the homeassistant service you need

sudo systemctl start [email protected]
sudo systemctl enable [email protected]

The second parameter refers to the file you created.

The /srv/homeassistant/bin/hass should be correct if you followed the instructions on the manual setup page. This was done with this line

(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ pip3 install homeassistant

Actually, the instruction for systemd are available on the wiki. You should probably use those, as they seem to have extra lines about the virtualenv (in the final example).

Mine was installed with hassbian a few months ago, and has obviously become out of date. Although I’m not going to change it while it works.

I followed the systemd instructions, but the step sudo systemctl enable home-assistant@homeassistant gives me the following:

Failed to execute operation: File exists

The systemctl status says:

pi@RPiSmartHome ~ $ sudo systemctl status home-assistant@homeassistant -l
● [email protected] - Home Assistant
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled)
   Active: failed (Result: exit-code) since Di 2017-03-07 09:25:51 CET; 15s ago
  Process: 5668 ExecStart=/usr/bin/hass (code=exited, status=203/EXEC)
 Main PID: 5668 (code=exited, status=203/EXEC)

Mär 07 09:25:51 RPiSmartHome systemd[1]: Started Home Assistant.
Mär 07 09:25:51 RPiSmartHome systemd[1]: [email protected]: main process exited, code=exited, status=203/EXEC
Mär 07 09:25:51 RPiSmartHome systemd[1]: Unit [email protected] entered failed state.

Your systemd file seems to be specifying that hass is at /usr/bin/hass. This is the first set of instructions on the systemd page.

You need to follow the instructions after the section that says

If you’ve setup Home Assistant in virtualenv following our python installation guide or manual installation guide for raspberry pi, the following template should work for you.

Thanks a lot, for some reason it didn’t save the content for /etc/systemd/system/[email protected] the first time. Now it’s working.

Since I messed around a lot trying to get HA running, can you tell me if I can delete any of the following files/folders?

$ sudo find / -name "homeassistant"

pi@RPiSmartHome ~ $ sudo find / -name "hass"

I think these directories are not used


But I would move them somewhere safe to make sure I’m right before deleting them entirely.:cold_sweat:

Thank you so much, is was really workly!