Trouble with Autostart on R Pi 3

Just finished manual installation of HA and all is working so far. Tried to install autostart as per tutorial and am receiving the following output from systemctl status:

      pi@raspberrypi:~ $ sudo systemctl status home-assistant@hass -l
● [email protected] - Home Assistant for hass
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
   Active: failed (Result: exit-code) since Sun 2016-10-02 15:05:56 UTC; 57s ago
   Process: 645 ExecStart=/usr/bin/hass --runner (code=exited, status=217/USER)
   Main PID: 645 (code=exited, status=217/USER)

Oct 02 15:05:56 raspberrypi systemd[1]: Started Home Assistant for hass.
Oct 02 15:05:56 raspberrypi systemd[1]: [email protected]: main process exited,     code=exited, status=217/USER
Oct 02 15:05:56 raspberrypi systemd[1]: Unit [email protected] entered failed state.
pi@raspberrypi:~ $ journalctl -f -u home-assistant@hass
No journal files were found.
^C

Did you reload after adding the service unit file? -> sudo systemctl --system daemon-reload

Hi- Yes, I did reload.

@fabaff the problem ended up being that I had the wrong file path for hass for ExecStart . I found it with locate, as I did not have whereis installed.

I am having this issue, but I cannot figure out where my path is wrong…

From the terminal, the following works:

source /srv/homeassistant/homeassistant_venv/bin/activate
hass --open-ui

My file [email protected]:

[Unit]
Description=Home Assistant
After=network.target

[Service]
Type=simple
User=hass
ExecStartPre=source /srv/homeassistant/homeassistant_venv/bin/activate
ExecStart= /srv/homeassistant/homeassistant_venv/bin/hass -c “/hass/.homeassistant”

[Install]
WantedBy=multi-user.target

And I get the error:

[email protected] - Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Mon 2016-12-26 19:44:57 UTC; 7s ago
Process: 12364 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass -c /hass/.homeassistant (code=exited, status=217/USER)
Main PID: 12364 (code=exited, status=217/USER)

Dec 26 19:44:57 raspberrypi systemd[1]: Started Home Assistant.
Dec 26 19:44:57 raspberrypi systemd[1]: [email protected]: main process exited, code=exited, status=217/USER
Dec 26 19:44:57 raspberrypi systemd[1]: Unit [email protected] entered failed state.

Try

/srv/homeassistant/homeassistant_venv/bin/hass -c "/homeassistant/.homeassistant

It’s a pain there’s 2 standard on how the user were named

I get:

[email protected] - Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Tue 2016-12-27 10:47:53 UTC; 4s ago
Process: 21128 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass -c /homeassistant/.homeassistant (code=exited, status=217/USER)
Main PID: 21128 (code=exited, status=217/USER)

Dec 27 10:47:53 raspberrypi systemd[1]: Started Home Assistant.
Dec 27 10:47:53 raspberrypi systemd[1]: [email protected]: main process exited, code=exited, status=217/USER
Dec 27 10:47:53 raspberrypi systemd[1]: Unit [email protected] entered failed state.

I am unsure when to use pi, hass, and homeassistant user profiles…

Hass is the application name. Then you’ll either have HomeAssistant user or hass user. That depends on your installation. Which one did you used?

I followed the manual installation on https://home-assistant.io/getting-started/installation-raspberry-pi/
So HomeAssistant…

Same as mine

[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=homeassistant
ExecStartPre=source /srv/homeassistant/homeassistant_venv/bin/activate
ExecStart= /srv/homeassistant/homeassistant_venv/bin/hass -c “/homeassistant/.homeassistant”
[Install]
WantedBy=multi-user.target

You got the user name wrong

Ok I now have exactly as your file (called [email protected]), I then:

pi@raspberrypi:/etc/systemd/system $ sudo systemctl --system daemon-reload
pi@raspberrypi:/etc/systemd/system $ sudo systemctl enable home-assistant@pi
pi@raspberrypi:/etc/systemd/system $ sudo systemctl start home-assistant@pi
pi@raspberrypi:/etc/systemd/system $ journalctl -f -u home-assistant@pi
No journal files were found.

I also tried ‘sudo systemctl enable [email protected]’ etc but still got ‘No journal files were found’.
Perhaps I am best to give up and go for the all in one installer at this point…?

I also just discovered Hassbian, I will try that

for some reason, i dont get the journal as well but HA is running fine. But you can always check the status using

sudo systemctl status home-assistant@homeassistant

In etc/systemd/system I have files [email protected] and [email protected], but NOT [email protected], where the @pi is the one I edited above… I get:

pi@raspberrypi:~ $ sudo systemctl status home-assistant@homeassistant

[email protected]
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

pi@raspberrypi:~ $ sudo systemctl status home-assistant@pi
[email protected] - Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Tue 2016-12-27 22:54:34 UTC; 7h ago
Process: 2996 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass -c /homeassistant/.homeassistant (code=exited, status=1/FAILURE)
Main PID: 2996 (code=exited, status=1/FAILURE)

Dec 27 22:54:33 raspberrypi systemd[1]: Started Home Assistant.
Dec 27 22:54:34 raspberrypi hass[2996]: Fatal Error: Specified configuration directory does not exist /homeassistant/…istant
Dec 27 22:54:34 raspberrypi systemd[1]: [email protected]: main process exited, code=exited, status=1/FAILURE
Dec 27 22:54:34 raspberrypi systemd[1]: Unit [email protected] entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

I wonder if I should be logged in as user homeassistant for this to work, but I do not know the password for this user (I get ‘Permissions denied’), and it is not the one I would have set had I been prompted to…

i think you should start again. you got all the name confused. In the first step in the autostart manual, you should put the [your user] as homeassistant if you install HA using the manual method.

$ su -c 'cat <> /etc/systemd/system/home-assistant@[your user].service

Will do, thanks again for your help rave, has been a learning curve…!

Hi!

So I have the service “working”. I can start, stop and view status. It says running and shows a log when I view status.

How ever, I can not do
systemctl enable homeassistant
get response that there is no such service.

whilst
service homeassistant start
or
service homeassistant stop
works just fine.

What to do?

Thanks!