Help, upgrade to Stretch broke my homeassistant

Hi,

Hope someone can help a novice.

I followed the suggestion in https://home-assistant.io/blog/2017/10/06/deprecating-python-3.4-support/
“If you’re running a Debian based system (like Hassbian), follow these instructions to upgrade.” Linking to this page:
https://linuxconfig.org/raspbian-gnu-linux-upgrade-from-jessie-to-raspbian-stretch-9

And now after upgrading, home assistant isn’t working.

If I activate the virtual environment for homeassistant and type pip or pip3 i get this error:
Traceback (most recent call last):
File “/srv/homeassistant/bin/pip3”, line 7, in
from pip import main
ImportError: No module named ‘pip’
So my logic thinking guesses I somehow need to update the virtual env with newer python version or something?
Also the homeassistant service gives this error:

Oct 06 18:18:14 *** sudo[4551]: pi : TTY=pts/0 ; PWD=/home/homeassistant ; USER=root ; COMMAND=/bin/systemctl start [email protected]
Oct 06 18:18:14 *** sudo[4551]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Oct 06 18:18:14 *** systemd[1]: Started Home Assistant for homeassistant.
Oct 06 18:18:14 *** sudo[4551]: pam_unix(sudo:session): session closed for user root
Oct 06 18:18:14 *** hass[4557]: Traceback (most recent call last):
Oct 06 18:18:14 *** hass[4557]: File “/srv/homeassistant/bin/hass”, line 7, in
Oct 06 18:18:14 *** hass[4557]: from homeassistant.main import main
Oct 06 18:18:14 *** hass[4557]: ImportError: No module named ‘homeassistant’
Oct 06 18:18:14 *** systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Oct 06 18:18:14 *** systemd[1]: [email protected]: Unit entered failed state.
Oct 06 18:18:14 *** systemd[1]: [email protected]: Failed with result ‘exit-code’.

I have a feeling I’ll end up reinstalling everything.

Thanks in advance,
nepa

I was worried something like this would cause issues.

I’m going to go ahead and clone my SD card and try this later on today and see what I get and get back to you on it. In the meantime however, I hope someone else with more knowledge than us can figure out the issue and get it resolved.

2 Likes

I have answered this in a couple of threads already. Try this reply

Although,I think you may need step 2 as well.

1 Like

Thanks, I was able to get home assistant running again after the stretch update.

However, my zwave component comes up with an error. Log says:

2017-10-07 16:24:50 ERROR (MainThread) [homeassistant.setup] Error during setup of component zwave
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 194, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/zwave/init.py”, line 269, in setup
config_path=config[DOMAIN].get(CONF_CONFIG_PATH))
File “/srv/homeassistant/lib/python3.5/site-packages/openzwave/option.py”, line 82, in init
libopenzwave.PyOptions.init(self, config_path=config_path, user_path=user_path, cmd_line=cmd_line)
File “src-lib/libopenzwave/libopenzwave.pyx”, line 678, in libopenzwave.PyOptions.init (openzwave-embed/open-zwave-master/python-openzwave/src-lib/libopenzwave/libopenzwave.cpp:11181)
libopenzwave.LibZWaveException: “LibOpenZwave Generic Exception : Can’t find config directory /srv/homeassistant/lib/python3.4/site-packages/python_openzwave/ozw_config”

So, Zwave apparently still links to python 3.4 stuff…

Edit: my configuration linked to the old openzwave config folder. Updated it and now zwave is back online.

zwave:
  usb_path: /dev/ttyACM0
  config_path: /srv/homeassistant/lib/python3.5/site-packages/python_openzwave/ozw_config
1 Like

Thanks for all your replies, appreciate it!

I will try your solution(s) when I get home from work today, and let you know how it worked out.

I have a similar, mostly related issue to this.

A while back I updated to stretch and it broke zwave - I somehow got it working again without setting a config_path.

I did the upgrade to HASS 0.55.0 today and now it will not start, citing zwave issues. I wish I’d actually seen this post first as it might have helped before I tried to fix it myself!

I have removed (pip3 uninstall openzwave - amongsth other things!) and then let HASS reinstall/compile it but it’s still not starting ZWave. I have the config directive above set.

These are the error messages being shown in the logs -

2017-10-09 20:54:17 ERROR (MainThread) [homeassistant.setup] Error during setup of component zwave
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/zwave/init.py”, line 276, in setup
File “src-lib/libopenzwave/libopenzwave.pyx”, line 745, in libopenzwave.PyOptions.lock (openzwave-embed/open-zwave-master/python-openzwave/src-lib/libopenzwave/libopenzwave.cpp:12301)

The first file exists. The second (src-lib/libopenzwave/libopenzwave.pyx) I cannot find anywhere.

Can anyone provide some guidance on what I need to do to get operational again?

What I did was made a copy of my srv/homeassistant folder before my upgrade. In that folder there is one called /srv/homeassistant/src.
After the up grade I too had no zwave. I copied the src folder back into homeassistant and did a restart of HASS and it worked.

No such luck here. Still getting the same error :frowning:

This is whats in that folder for me. Do you have the same?

image

Thanks gpbenton, I got homeassistant running again now!

But now I have problems getting Mosquitto running, is this also a known problem with upgrading to scratch?

The mosquitto log hasnt recorded anything since the update, and the service says it is running.
But as soon as i try testing with mosquitto_sub and\or mosquitto_pub i get error :

Error: Connection refused

There are a few threads in the forum about problems with Mosquitto after upgrading, and there are a couple of solutions, so I suggest you do a search.

I think I avoided them because I get my packages directly from the mosquitto.org debian package site using these instructions http://mosquitto.org/2013/01/mosquitto-debian-repository/. Just replace jessie with stretch when necessary, and you get a workable version. This is rather non-hassbian though, so you may want to stick to the mainstream.

I actually have a whole lot more than that -

driver.pxd libopenzwave.pyx mylibc.pxd options.pxd
group.pxd log.pxd node.pxd values.pxd
libopenzwave.cpp manager.pxd notification.pxd

What’s interesting to me is that according to the CHANGELOG in the python-openzwave folder, this appears to be source code for version 0.33.

I’m actually going to start another new virtual environment and reinstall HA to it and see what happens…

This still nets the same error. Any other ideas?

Thanks, I tried searching, but didn’t find a solution that worked for me.

Tried adding the mosquitto repository you suggested, but that gave an error on a dependency libwebsockets3.

So then I went back to the official source and used apt to remove and purge mosquitto and mosquitto-client
After installing it again from scratch it is working fine!

All good now, thanks for all your help!

1 Like

Thanks for the guidance on this Dayve67. I haven’t been well lately but today felt like I had the brain capacity to sort this out - only took me about 15mins to find the problem in the end.

It’s party because I started with an AiO installation and switched to a virtual environment when I did the stretch upgrade.

I had an options.xml (Zwave config file) file within my home assistant home directory. It was a symlink pointing to a folder which was also a symlink, for an old zwave version from the original install. Should have all worked as the paths were still valid, but it was looking for a config set from libopenzwave 0.3.3 so I decided to get rid of that. I deleted the options.xml file, restarted home-assistant and zwave came straight up. It’s now regenerated its own file and so far it seems that things are working as they should.

hi,

I’ve done all this started with…

sudo mv /srv/homeassistant /srv/ha_old

after i’ve recreated my new virtual env and reinstalled HA, how do i resotre the old config from… /srv/ha_old

?

Your configuration is not stored in the virtual environment, it is in

/home/homeassistant/.homeassistant/configuration.yaml

Ah - ok, I misunderstood, got that.

So it’s probably all fine - only thing is it’s not starting up when the pi reboots as it used to - do I need to do something else to get it to autostart post this stretch upgrade and reinstall of the virtual environment.

Again, this has nothing to do with the virtual environment.

Try the following command

pi@raspberrypi:~ 
$ systemctl status [email protected][email protected] - Home Assistant for homeassistant
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: 
   Active: active (running) since Sun 2017-11-19 11:49:40 GMT; 1 weeks 4 days ago
 Main PID: 15641 (hass)
   CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]
           └─15641 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass

If you get disabled instead of enabled in the loaded: line then

$ sudo systemctl enable [email protected]

should be ok.

If there is more wrong, you could try researching what is missing from this page

thanks for this… says

Loaded: loaded
Active: failed