It is also trying to access something outside the venv, which shouldnβt happen.
To start with, I would delete the existing venv directory, because its obviously messed up, and recreate it, going from step 2 in
You also need to check that your startup script is actually using the venv that you had. If it was running a different version it could be just running a different installation than you think.
pi@raspberrypi:/srv $ sudo mkdir /srv/homeassistant
pi@raspberrypi:/srv $ ls
homeassistant
pi@raspberrypi:/srv $ sudo chown homeassistant:homeassistant /srv/homeassistant
pi@raspberrypi:/srv $ sudo su -s /bin/bash homeassistant
homeassistant@raspberrypi:/srv $ virtualenv -p python3 /srv/homeassistant
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /srv/homeassistant/bin/python3
Also creating executable in /srv/homeassistant/bin/python
Installing setuptools, pip, wheel...done.
homeassistant@raspberrypi:/srv $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@raspberrypi:/srv $ pip3 install --upgrade homeassistant
Collecting homeassistant
Downloading homeassistant-0.55.0-py2.py3-none-any.whl (7.4MB)
100% |ββββββββββββββββββββββββββββββββ| 7.4MB 38kB/s
Collecting pyyaml<4,>=3.11 (from homeassistant)
Downloading PyYAML-3.12.tar.gz (253kB)
100% |ββββββββββββββββββββββββββββββββ| 256kB 676kB/s
Collecting async-timeout==1.4.0 (from homeassistant)
Downloading async_timeout-1.4.0-py3-none-any.whl
Collecting aiohttp==2.2.5 (from homeassistant)
Downloading aiohttp-2.2.5.tar.gz (788kB)
100% |ββββββββββββββββββββββββββββββββ| 798kB 302kB/s
Collecting requests==2.14.2 (from homeassistant)
Using cached requests-2.14.2-py2.py3-none-any.whl
Collecting typing<4,>=3 (from homeassistant)
Downloading typing-3.6.2-py3-none-any.whl
Collecting chardet==3.0.4 (from homeassistant)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |ββββββββββββββββββββββββββββββββ| 143kB 973kB/s
Collecting jinja2>=2.9.6 (from homeassistant)
Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting astral==1.4 (from homeassistant)
Downloading astral-1.4-py2.py3-none-any.whl
Collecting pytz>=2017.02 (from homeassistant)
Using cached pytz-2017.2-py2.py3-none-any.whl
Requirement already up-to-date: pip>=8.0.3 in ./homeassistant/lib/python3.4/site-packages (from homeassistant)
Collecting voluptuous==0.10.5 (from homeassistant)
Using cached voluptuous-0.10.5.tar.gz
Collecting multidict>=2.1.4 (from aiohttp==2.2.5->homeassistant)
Downloading multidict-3.2.0.tar.gz
Collecting yarl>=0.11 (from aiohttp==2.2.5->homeassistant)
Downloading yarl-0.13.0.tar.gz (136kB)
100% |ββββββββββββββββββββββββββββββββ| 143kB 949kB/s
Collecting MarkupSafe>=0.23 (from jinja2>=2.9.6->homeassistant)
Using cached MarkupSafe-1.0.tar.gz
Building wheels for collected packages: pyyaml, aiohttp, voluptuous, multidict, yarl, MarkupSafe
Running setup.py bdist_wheel for pyyaml ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/2c/f7/79/13f3a12cd723892437c0cfbde1230ab4d82947ff7b3839a4fc
Running setup.py bdist_wheel for aiohttp ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/0b/3d/49/66a36247a1e45955ab32c3fc21c890ee407c5147bd7238b5b7
Running setup.py bdist_wheel for voluptuous ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/04/da/a7/52954cfc62b4a5d72cbdab1eceec279ab7511acaddb00e71e7
Running setup.py bdist_wheel for multidict ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/29/e3/d7/74cb45defe328e04ba904142c8a3ca02a25181dc7d579d7d1f
Running setup.py bdist_wheel for yarl ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/d3/2a/da/e2551d2518b8bf302b6d298f985b725faea2bd36f30ceb4254
Running setup.py bdist_wheel for MarkupSafe ... done
Stored in directory: /home/homeassistant/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57
Successfully built pyyaml aiohttp voluptuous multidict yarl MarkupSafe
Installing collected packages: pyyaml, async-timeout, chardet, multidict, yarl, aiohttp, requests, typing, MarkupSafe, jinja2, pytz, astral, voluptuous, homeassistant
Successfully installed MarkupSafe-1.0 aiohttp-2.2.5 astral-1.4 async-timeout-1.4.0 chardet-3.0.4 homeassistant-0.55.0 jinja2-2.9.6 multidict-3.2.0 pytz-2017.2 pyyaml-3.12 requests-2.14.2 typing-3.6.2 voluptuous-0.10.5 yarl-0.13.0
(homeassistant) homeassistant@raspberrypi:/srv $ sudo su -s /bin/bash pi
I can now ssh in but cannot access the front end. It looks like home assistant is not running?:
pi@raspberrypi:~ $ sudo systemctl status home-assistant@pi
β [email protected] - Home Assistant for pi
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Sun 2017-10-08 11:17:06 EDT; 1h 18min ago
Process: 703 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass --runner (code=exited, status=203/EXEC)
Main PID: 703 (code=exited, status=203/EXEC)
Oct 08 11:17:06 raspberrypi systemd[1]: Starting Home Assistant for pi...
Oct 08 11:17:06 raspberrypi systemd[1]: Started Home Assistant for pi.
Oct 08 11:17:06 raspberrypi systemd[1]: [email protected]: main process exited, code=exited, status=203/EXEC
Oct 08 11:17:06 raspberrypi systemd[1]: Unit [email protected] entered failed state.
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 start home-assistant@pi
pi@raspberrypi:~ $ sudo systemctl status home-assistant@pi
β [email protected] - Home Assistant for pi
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Sun 2017-10-08 12:36:23 EDT; 36s ago
Process: 1037 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass --runner (code=exited, status=203/EXEC)
Main PID: 1037 (code=exited, status=203/EXEC)
Oct 08 12:36:23 raspberrypi systemd[1]: Started Home Assistant for pi.
Oct 08 12:36:23 raspberrypi systemd[1]: [email protected]: main process exited, code=exited, status=203/EXEC
Oct 08 12:36:23 raspberrypi systemd[1]: Unit [email protected] entered failed state.
pi@raspberrypi:~ $
Just checking - and Iβm sure this is an obvious question, but are you running the source command to actually initialize the VENV environment when you log in as the HASS user? if you donβt run that every time you log in then you will not be updating HASS in the VENV, and instead update it on the local machine. That means you could have .55 outside of the VENV, and .44 inside. (Iβve fallen into this trap too). I ask because your original post doesnβt show the VENV when you were running pip install
The first is the homeassistant service is being run as pi user, as shown in
whereas the virtual environment you just installed was by the homeassistant user.
Secondly, the service is running a virtual environment at
which is not the location of the virtual environment you just created.
You can fix this by renaming /etc/systemd/system/[email protected] to /etc/systemd/system/[email protected], and then editing that file to use /srv/homeassistant venv.
However, you clearly donβt have much understanding of what you are doing, and so are exactly the sort of user that the hass.io installation method was created for. You could just save your configuration file elsewhere to use again, install hassio on your sd card and not have to worry about the command line and virtual environments again. From what I understand, updates occur pretty much at the press of a button.
Thank you for the pointers. And you are right, I donβt have a solid idea of what I am doing, I am an amateur user. I need to learn more. However, hass.io doesnβt give the the control I need, for instance I frequently access HA using Tor.
Ok I renamed the file, below are the contents of said file. You are referring to the line that starts with βExecStartβ ? This document is the auto start script correct?
# This is a simple service file for systems with systemd to tun HA as user.
#
# For details please check https://home-assistant.io/getting-started/autostart/
#
[Unit]
Description=Home Assistant for %i
After=network.target
[Service]
Type=simple
User=%i
# Enable the following line if you get network-related HA errors during boot
#ExecStartPre=/usr/bin/sleep 60
# Use `whereis hass` to determine the path of hass
ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass --runner
SendSIGKILL=no
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
That will get your configuration back matching most of the installations described on the website, so you should be able to do upgrades as you described in your second post.
As was said by mconway, make sure you get into the correct virtual environment before invoking pip, or will get other versions of ha installed in various places, which becomes very confusing.
Ok, so HA is now all updated and autostart is working correctly thanks to your instructions, which I very much appreciate. Now, since its effectively a new installation, I have to migrate over my configuration.yaml file, which is easy. Additionally I have to install MQTT and some other things that I had on my old installation, like the aforementioned tor onion service. Is there a better way to go about these two tasks other than simply redoing it from scratch?
It shouldnβt really be necessary. The installation of tor and mosquitto is independent of where home assistant is running. They are completely separate things. Nothing you have done so far will have affected them in any way.