Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2023.6 does not start #94239

Closed
UweDoe opened this issue Jun 8, 2023 · 15 comments · Fixed by #94587
Closed

Update 2023.6 does not start #94239

UweDoe opened this issue Jun 8, 2023 · 15 comments · Fixed by #94587

Comments

@UweDoe
Copy link

UweDoe commented Jun 8, 2023

The problem

After updating to 2023.6 and restarting home assistant the system does not come up and shows errors in the log:

Logger: homeassistant.loader
Source: components/cloud/http_api.py:504
First occurred: 10:41:23 (1 occurrences)
Last logged: 10:41:23

Unexpected exception importing component homeassistant.components.cloud
Traceback (most recent call last):
File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/loader.py", line 813, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/components/cloud/init.py", line 35, in
from . import account_link, http_api
File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/components/cloud/http_api.py", line 504, in
hass: HomeAssistant, cloud: Cloud[CloudClient]
TypeError: 'type' object is not subscriptable

The complete logs are attched

What version of Home Assistant Core has the issue?

core-2023.6.0

What was the last working version of Home Assistant Core?

core-2023.5.4

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

home-assistant_2023-06-08T09-16-01.267Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@freeDom-
Copy link
Contributor

freeDom- commented Jun 8, 2023

  1. Python 3.10 support was removed, but is still used. Consider upgrading to python 3.11
  2. Looks like your problem is related to the changes implemented in Enable strict type checks of cloud #92576 for homeassistant/components/cloud/http_api.py

@Ruvetuve
Copy link

Ruvetuve commented Jun 8, 2023

You where faster creating an issue. Weird thing is I have the same on Home Assistant docker. Same issue for cloud module and mobile_app

ERROR (MainThread) [homeassistant.setup] Setup failed for cloud: Unable to import component: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/usr/lib/python3.10/site-packages/urllib3/util/ssl_.py)

ERROR (MainThread) [homeassistant.setup] Setup failed for mobile_app: Unable to import component: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/usr/lib/python3.10/site-packages/urllib3/util/ssl_.py)

@frenck
Copy link
Member

frenck commented Jun 8, 2023

Weird thing is I have the same on Home Assistant docker

That is odd, as your error message says:

Unable to import component: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/usr/lib/python3.10/site-packages/urllib3/util/ssl_.py)

The oddity here is python3.10, however, we don't ship Python 3.10 in our Docker images for Home Assistant?

../Frenck

@Ruvetuve
Copy link

Ruvetuve commented Jun 8, 2023

It results in mobile_app not starting (resulting in unavailability of group and thus alarm on). What could I do to debug this further? (sry don't want ti hi-jack the issue)

I'm using docker: ghcr.io/linuxserver/homeassistant and the issue is logged there: linuxserver/docker-homeassistant#70

@Ulrar
Copy link

Ulrar commented Jun 8, 2023

@Ruvetuve That has nothing to do with home assistant, that issue is caused by the linuxserver (which is not the official image) still using python 3.10. As indicated in the issue you linked they are already working on updating it and you can use that test build linked the issue, but it's causing other issues with hacs so it doesn't seem ready yet. Regardless, it's not really in scope for HA's devs, linuxserver is it's own thing

@UweDoe
Copy link
Author

UweDoe commented Jun 8, 2023

Do I understand correctly, this problem should not show up after updating python to 3.11 ? Can somebody confirm this?
Is there a different type checking in python 3.11? Since my fault seems to be a side effect of the correction in #92576

Generally Python 3.10 is still usable until 2023.8. Therefore, any corrections should be done compatible.

@furritos
Copy link

furritos commented Jun 8, 2023

@UweDoe, not sure about 3.11.

I'm on MacOS 10.15 using Python 3.11.3 and this error comes up as well.

image

Using homebrew'd Python 3.11.3, fyi.

@MrTeal
Copy link

MrTeal commented Jun 9, 2023

I'm not sure if it is the same issue, but my HA running on Docker on a RaspberryPi 4 is also not starting and complaining about python3.11:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun home-assistant (no readiness notification)
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 226, in
sys.exit(main())
^^^^^^
File "/usr/src/homeassistant/homeassistant/main.py", line 181, in main
args = get_arguments()
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/main.py", line 81, in get_arguments
from . import config as config_util
File "/usr/src/homeassistant/homeassistant/config.py", line 20, in
from . import auth
File "/usr/src/homeassistant/homeassistant/auth/init.py", line 19, in
from .mfa_modules import MultiFactorAuthModule, auth_mfa_module_from_config
File "/usr/src/homeassistant/homeassistant/auth/mfa_modules/init.py", line 12, in
from homeassistant import data_entry_flow, requirements
File "/usr/src/homeassistant/homeassistant/requirements.py", line 10, in
import pkg_resources
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 3326, in
@_call_aside
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 3301, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 3339, in _initialize_master_working_set
working_set = WorkingSet._build_master()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 620, in _build_master
ws = cls()
^^^^^
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 613, in init
self.add_entry(entry)
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 669, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 2133, in find_on_path
for dist in factory(fullpath):
File "/usr/local/lib/python3.11/site-packages/pkg_resources/init.py", line 2191, in distributions_from_metadata
if len(os.listdir(path)) == 0:
^^^^^^^^^^^^^^^^
OSError: [Errno 74] Bad message: '/usr/local/lib/python3.11/site-packages/pyquery-2.0.0.dist-info'
[04:18:24] INFO: Home Assistant Core finish process exit code 1
[04:18:24] INFO: Home Assistant Core service shutdown
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

EDIT: removed code tags as it makes it less readable.

Edit 2: 2023.6.1 fixed it for me HA boots again.

@glcos
Copy link
Contributor

glcos commented Jun 9, 2023

Same issue here, Raspberry Pi 4, Python 3.11.2, HA Core 2023.6.1

2023-06-09 17:29:53.779 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.cloud
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/cloud/__init__.py", line 35, in <module>
    from . import account_link, http_api
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/cloud/http_api.py", line 504, in <module>
    hass: HomeAssistant, cloud: Cloud[CloudClient]
                                ~~~~~^^^^^^^^^^^^^
TypeError: type 'Cloud' is not subscriptable

and I'm also getting this error:

2023-06-09 17:31:39.974 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.mobile_app
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/mobile_app/__init__.py", line 5, in <module>
    from homeassistant.components import cloud, notify as hass_notify
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/cloud/__init__.py", line 35, in <module>
    from . import account_link, http_api
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/cloud/http_api.py", line 504, in <module>
    hass: HomeAssistant, cloud: Cloud[CloudClient]
                                ~~~~~^^^^^^^^^^^^^
TypeError: type 'Cloud' is not subscriptable

Any idea?

@prj
Copy link

prj commented Jun 11, 2023

Dead for me as well after update. Nice one.

Except I don't even have anything in /config/home-assistant.log at all apart from some hacs not tested messages.
I am on HassIO too...

@prj
Copy link

prj commented Jun 11, 2023

HA not listening on port 8123:

➜  ~ netstat -an |grep LISTEN
tcp        0      0 172.30.32.1:64840       0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:46836         0.0.0.0:*               LISTEN
tcp        0      0 172.30.32.1:62935       0.0.0.0:*               LISTEN
tcp        0      0 172.30.32.1:62454       0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:4357            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:1880            0.0.0.0:*               LISTEN

And yes I tried to power cycle it of course.

Docker logs show it's chain resetting:

[15:34:10] INFO: Home Assistant Core finish process exit code 256
[15:34:10] INFO: Home Assistant Core finish process received signal 11
2023-06-11 18:34:19.182 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:19.186 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration daily which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:19.190 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration bosch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:19.193 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:19.197 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration average which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:19.200 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration places which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
[15:34:22] INFO: Home Assistant Core finish process exit code 256
[15:34:22] INFO: Home Assistant Core finish process received signal 11
2023-06-11 18:34:31.532 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:31.536 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration daily which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:31.539 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration bosch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:31.543 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:31.546 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration average which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:31.550 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration places which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
[15:34:37] INFO: Home Assistant Core finish process exit code 256
[15:34:37] INFO: Home Assistant Core finish process received signal 11
2023-06-11 18:34:49.738 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:49.743 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration daily which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:49.746 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration bosch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:49.751 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:49.755 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration average which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-06-11 18:34:49.758 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration places which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
[15:34:52] INFO: Home Assistant Core finish process exit code 256
[15:34:52] INFO: Home Assistant Core finish process received signal 11

And backup restore fails too:

➜  ~ ha backups restore e3afce37
Processing... Done.

Error: Unknown error, see supervisor
➜  ~
23-06-11 19:06:57 ERROR (MainThread) [supervisor.backups.manager] e3afce37 is only a partial backup!

Every time I update HA I ask myself, why did I do it? It's almost always a mistake and ends in tons of wasted time... over the last few years, I think 1 or 2 updates went smoothly and 4 or 5 caused HA to be completely unreachable. Can't complain about free software of course, but I don't know any software that has this comical of a track record.

The core is chain restarting. The supervisor does not accept commands because the core is chain restarting. It is not possible to stop it or update it either :D

@prj
Copy link

prj commented Jun 11, 2023

Solution:

ha core options --watchdog=false
docker kill homeassistant
ha core stop
ha core update --version 2023.3.1

You will get update failed error, ignore it, that's wrong like everything else with this software :D
Actually it completes just fine and then supervisor throws an error, but it's perfectly normal in this world.

Continue with:

ha core start
ha core options --watchdog=true

Enjoy working home assistant on 2023.3.1.

Why this info is nowhere to be found on the official website is beyond me, considering there is an over 50% chance that an update will brick your install and this is the only way to roll back.

@skandalfo
Copy link
Contributor

I also got TypeError: type 'Cloud' is not subscriptable on python 3.11... seems like updating the typing_extensions package to the latest version fixed it for me.

@hogend
Copy link

hogend commented Jun 14, 2023

I also got TypeError: type 'Cloud' is not subscriptable on python 3.11... seems like updating the typing_extensions package to the latest version fixed it for me.

Thanks! That fixed it. So, the dependency should updated to: typing-extensions (>=4.6.3)

@freeDom-
Copy link
Contributor

Created a PR to update typing_extensions dependency to 4.6.3 or greater

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.