Setup failed for cloud: Unable to import component

With HA 0.102.3 in VENV and Python 3.7.5, after upgrade and then also clean install, the component ‘cloud’ fails to initialize somehow.

ERROR (MainThread) [homeassistant.setup] Setup failed for cloud: Unable to import component
ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mobile_app. Setup failed for dependencies: cloud
ERROR (MainThread) [homeassistant.setup] Setup failed for mobile_app: Could not set up all dependencies.
ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: cloud, mobile_app
ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: Could not set up all dependencies.

Could not get any more clues despite loglevel set to ‘debug’.

How can I find out more about the error, or the name of the involved files ?

thanks

Honestly this is just a wild a-- guess but I suspect it might at least fix the mobile_app

Inside your virtualenv try installing PyNaCl manually.

pip3 install --upgrade PyNaCl==1.3.0

Python was compiled without package uuid-dev available, tough recompile did not solve the problem.

Next step was downgrade to HA 0.101.0, which logged dutyful:

ERROR (MainThread) [homeassistant.config] Unable to import cloud: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /srv/homeassistant/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so)
2019-12-07 21:59:29 ERROR (MainThread) [homeassistant.setup] Setup failed for cloud: Invalid config.

Have to install package gnutls-openssl-dev and rebuild python.

Hello !

I have the very same problem, home assistant installed on top of raspbian, and after updating python and hass, can’t load cloud and mobile app… Btw, lovelace won’t show up either, but let’s go step by step.

Could you please tell me which steps to follow to get everything working nicely ?
I’m not very experimented with python related problems, and I’m not sure how to install uuid-dev (inside venv ? As which user ?) or “rebuild python”…

Thanks in advance and sorry for these noob questions !

First of all, downgrade HA to -version=0.101.0 because the most recent wont show the cause of any errors which seems to be a nasty bug.

Python 3.7.x requires OpenSSL 1.1.1, or will be simply built without.
Now with LD_LIBRARY_PATH=/usr/local/lib python will be able to use openssl 1.1.1.

But then new problems arise: HA now suddenly wants libc 2.25 and then segfaults:

ERROR (MainThread) [homeassistant.config] Unable to import mobile_app: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.25' not found (required by /srv/homeassistant/lib/python3.7/site-packages/nacl/_sodium.abi3.so)
Process: 12303 ExecStart=/srv/homeassistant/bin/hass -c /home/homeassistant/.homeassistant (code=killed, signal=SEGV)

Upgrading libc on poor Raspbian is no choice if you dont want to mess everything up.
Raspbian is simply not compatible with the latest HA-VENV.

Use docker instead, but install via get-docker.sh and not from the package-manager.
Then everything will work nicely out of the box, to start HA on boot from systemd, cron or /etc/rc.local use the command:

/usr/bin/docker start -a home-assistant

Unfortunately I cannot use docker as I run an arm device.

I’m seeing a very similar error:

2019-12-12 20:34:58 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config>
2019-12-12 20:34:59 ERROR (MainThread) [homeassistant.config] Unable to import cloud: /usr/lib/libssl.so.1.0.0: internal error
2019-12-12 20:34:59 ERROR (MainThread) [homeassistant.setup] Setup failed for cloud: Invalid config.

Unfortunately I cannot find any details about what this internal error may be or where to investigate for additional log files.

I had to install older version of HA (–version=0.101.0 in my case) to get any meaningful logging.

libssl.so.1.0.0 seems rather old. Did you really installed openssl-1.1.1 ?
In my case Python3.7 compiled succesfully with openssl-1.1.0 (from libssl.so.1.1) but insisted on openssl-1.1.1 at runtime or ‘cloud’ would not load.

To check the actual openssl library version use:

$ strings -f /usr/lib/arm-linux-gnueabihf/libssl* | grep OPENSSL_1_
/usr/lib/arm-linux-gnueabihf/libssl.so: OPENSSL_1_1_0
/usr/lib/arm-linux-gnueabihf/libssl.so: OPENSSL_1_1_0d
/usr/lib/arm-linux-gnueabihf/libssl.so: OPENSSL_1_1_0i
/usr/lib/arm-linux-gnueabihf/libssl.so: OPENSSL_1_1_0f
/usr/lib/arm-linux-gnueabihf/libssl.so.1.1: OPENSSL_1_1_0
/usr/lib/arm-linux-gnueabihf/libssl.so.1.1: OPENSSL_1_1_0d
/usr/lib/arm-linux-gnueabihf/libssl.so.1.1: OPENSSL_1_1_0i
/usr/lib/arm-linux-gnueabihf/libssl.so.1.1: OPENSSL_1_1_0f

Even those are definitely too old for recent HA, but you probably installed OpenSSL into --prefix=/usr/local or maybe even /opt and need to adjust the path accordingly.

Once you found OPENSSL_1_1_1 force python to use it for configure/compile:

File python-build.sh:

export LDFLAGS="-L/usr/local/lib/"
export LD_LIBRARY_PATH="/usr/local/lib/"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/openssl"
export CFLAGS="-I/usr/local/include -I/usr/local/include/openssl"

./configure --prefix=/usr/local/ --enable-optimizations --with-ssl || exit
make -j3 build_all || exit
make altinstall

To check python/openssl version use:

File python-checkssl.sh:

#!/bin/sh -x

export LD_LIBRARY_PATH="/usr/local/lib/"

/usr/bin/python python-checkssl.py
/usr/bin/python3 python-checkssl.py
/usr/local/bin/python3.7 python-checkssl.py

File python-checkssl.py

#!/usr/local/bin/python3

import ssl
print ( ssl.OPENSSL_VERSION )

Setting LD_LIBRARY_PATH is probably required whenever you want Python to use openssl-1.1.1.

Thanks @zrh,
I opened an issue about the logging at https://github.com/home-assistant/home-assistant/issues/29907

I have downgraded homeassistant to find my error (sorry for not explicitly stating that here). It’s how I was able to get the libssl error.

I run on a synology box so I’m not sure if I installed this or that’s what was already installed.

You are correct: I have the most recent version already under /opt/lib

I’m looking into recompiling python as my package manager had handle that for me

I wasn’t able to recompile python (I’ll need to retrace my steps to figure out how I’d gotten it installed to begin with)

check SSL results:
python ./checkSSL.py
OpenSSL 1.0.2r-fips 26 Feb 2019

python3 ./checkSSL.py
OpenSSL 1.1.1d 10 Sep 2019

Do I need to install a newer version/update Python 2*?

EDIT:

I’ve been able to resolve this error by calling:

cd /opt/lib
ln libssl.so libssl.so.1.1
ln libssl.so.1.1 libssl.so.1.0.0
ln libcrypt-2.27.so libcrypto.so.1.0.0

Once these were in place my path’s resolve the import correctly and the cloud component could be imported.

Hello,

I am also running on a raspberry pi, and have the same / similar issues.
I’ve compiled Python 3.7, with SSL as far as I can tell.
Getting 3.7 compiled was “fun”, but I got there with a combination of the following:
https://stackoverflow.com/questions/41098252/pip-install-require-tls-ssl
https://stackoverflow.com/questions/53543477/building-python-3-7-1-ssl-module-failed

I’ve HA run version 0.101.0 as suggested above and get the following error.

The python-build.sh gives

OpenSSL 1.0.2o  27 Mar 2018
OpenSSL 1.0.2o  27 Mar 2018
OpenSSL 1.1.1d  10 Sep 2019

I running in the virtual environment, its been working fine, so don’t really want to have to go the docker route.

I’ve tried add LD_LIBRARY_PATH to the bin/activate script, for the SSL libraries.
I’ve also tried the ‘ln’ suggested by forge.

Can anyone else suggest what to do?

The error I am seeing is

Unable to import cloud: /usr/src/openssl-1.1.1d/lib/libssl.so.1.1: version `OPENSSL_1.0.1' not found (required by /srv/homeassistant/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so)

Where is the reference to OPENSSL_1.0.1 in /srv/homeassistant/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so coming from?
How do I make it use 1.1?

Any help appreciated.

I have things working for now, by reverting to a python 3.6 based virual environment.
But that means I can no longer upgrade HA, as it requires 3.7!

UPDATE Jan 01 2020.
I decide to complete rebuild my server from scratch, so have now side stepped this issue.

I faced up the same problem.
I run homeassistant in virual enviroment on Debian.

Upgraded HA to 2021.1.5 and Python to 3.8. Installed openssl 1.1.1d. Reinstalled cryptography. No success.

I run:

ldd [your_path_to_homeassistant]/lib/python3.8/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so

and found it referenced here /usr/lib/i386-linux-gnu/i686/cmov/ and still used 1.0:

    linux-gate.so.1 (0xb7784000)
 libssl.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0 (0xb764a000)
 libcrypto.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libcrypto.so.1.0.0 (0xb747c000)
    libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb745f000)
    libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb72b2000)
    libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb72ad000)
    /lib/ld-linux.so.2 (0xb7785000)

So I renamed folder cmov to cmov_arch.
Unistalled cryptography by: pip uninstall cryptography and install it with:

LDFLAGS=-L/usr/local/lib CFLAGS=-I/usr/local/include pip install cryptography==3.2

Reload HA and the error fixed!

I run again to check:

ldd [your_path_to_homeassistant]/lib/python3.8/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so

and now it uses 1.1:

    linux-gate.so.1 (0xb777a000)
 libssl.so.1.1 => /usr/local/lib/libssl.so.1.1 (0xb7607000)
 libcrypto.so.1.1 => /usr/local/lib/libcrypto.so.1.1 (0xb731e000)
    libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb7301000)
    libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7154000)
    libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb714f000)
    /lib/ld-linux.so.2 (0xb777b000)

i solved my issue by following this guide

by disabling IPv6 from the supervisor page here

I hope this helps.