New install on Debian - some questions

Hi everyone, lets just get this out of the way and say im a total newbie to Linux so have mercy. But im willing to learn …just need a hand and some patience!

just starting out with hass that im running on an upgraded mac mini (2.1) ive had around running :
Intel Core2 (t7600)
4GB Ram
Debian 9 - Stretch 64Bit w/Gnome

Installed Hass using Python Virtual Environment
Is this the best way to run Hass on Debian. Should i have used a container like Docker instead?
Installation was no problem - hass ran fine. Trying to autostart using systemd
I dont think im doing it correctly.
When i type

whereis hass it returns hass:
However if i start the virtual environment - source bin/activate it returns
hass: /home/theuser/homeassistant/bin/hass

ok from what i understand i need to edit or create? (unclear here) a file using the template for Python Virtual Env. So i did the following:

sudo nano -w /etc/systemd/system/[email protected]

then paste and modify as per above whereis:

[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
ExecStart=/home/theuser/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
[Install]
WantedBy=multi-user.target

Then i follow the steps outlined in the autostart document:
sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
Created symlink /etc/systemd/system/multi-user.target.wants/[email protected] → /etc/systemd/system/[email protected].
sudo systemctl start home-assistant@homeassistant

…and nothing happens

If i run sudo systemctl status home-assistant@homeassistant

Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-02-13 19:07:54 CST; 30s ago
  Process: 1654 ExecStart=/home/theuser/homeassistant/bin/hass -c /home/homeassistant/.homeassistant (code=exited, status=1/FAILURE)
 Main PID: 1654 (code=exited, status=1/FAILURE)

Feb 13 19:07:52 MacDebian systemd[1]: Started Home Assistant.
Feb 13 19:07:54 MacDebian hass[1654]: Fatal Error: Specified configuration directory does not exist /home/homeassistant/.homeassistant
Feb 13 19:07:54 MacDebian systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Feb 13 19:07:54 MacDebian systemd[1]: [email protected]: Unit entered failed state.
Feb 13 19:07:54 MacDebian systemd[1]: [email protected]: Failed with result 'exit-code'.

My guess is that im either not creating the template file in the right location or the path to the hass thing is incorrect for ExecStart

Should be simple to fix. Get into your virtual environment:

cd /home/theuser/homeassistant
source bin/activate
hass

That will start Home Assistant and create a blank config in /home/theuser/.homeassistant.

After you’re able to access the GUI at http://localhost:8123, Ctrl+C in the terminal window to shut down Home Assistant.

You’ll need to edit the systemd service file /etc/systemd/system/[email protected] and change this line:

ExecStart=/home/theuser/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

to

ExecStart=/home/theuser/homeassistant/bin/hass -c "/home/theuser/.homeassistant"

Then do:
sudo systemctl daemon-reload.

From then on, this:

sudo systemctl start home-assistant@homeassistant

should not return an error, and because you’ve done sudo systemctl enable home-assistant@homeassistant, HA will start on boot.

I run on debian with a venv and think it’s the best way*

But @flamingm0e will be along in a minute to tell you that docker is the best way¶

* for me
¶ for him

Horses for courses :wink:

Seems like the paths for the service file are wrong, so…

Do you really have a user called ‘theuser’?

Can you navigate to your .homeassistant folder and give us the path?

Lol. I was going to do no such thing.

1 Like

This did it! Thank you. It seems to boot on start now. Or at least when i access the Ip:port from my browser it loads the Hass Splash screen…however it seems to be stuck on Connecting…

Any thoughts?

also an additional question: In the autostart instructions it says:

For most systems, the file is /etc/systemd/system/home-assistant@[your user].service with [your user] replaced by the user account that Home Assistant will run as (normally homeassistant). In particular, this is the case for Ubuntu 16.04.

I just picked homeassistant to replace [your user] at random…is this correct or should i have checked what the actual user created was?! Im not sure what is meant by

replaced by the user account that Home Assistant will run as

haha good catch. Not its my name but for simplicity and specificity i used something benign.

Oh yes you should rename that file so that “theuser” follows the @ symbol. Then daemon-reload, and then start it.

Beauty! works like a charm! Thanks so much for your help

No problem! Sorry that skipped my mind when posting the instructions earlier.