home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.94k stars 29.03k forks source link

[homeassistant.bootstrap] Setup timed out for stage 1 waiting on set() - moving forward when updating to a monthlhly release #119023

Open Nardol opened 1 month ago

Nardol commented 1 month ago

The problem

Since Home Assistant 2024.4, when updating for the first time of the month E.G. from 2024.3.x to 2024.4.0 and restart Home Assistant core, setup is timed out and some integration are not available. It looks all integrations depending to Bluetooth are unavailable. If I restart Home Assistant again, setup finishes successfully and all integrations are available.

What version of Home Assistant Core has the issue?

2024.6.0 but it began with 2024.4

What was the last working version of Home Assistant Core?

2023.3.x

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_timeout.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Log file put in place of diagnostic

Additional information

As precised, for every major release, I now have to start Home Assistant core twice (first time with timeout) to have a fully functional HA.

bdraco commented 1 month ago

Looks like it gets stuck updating bleak 2024-06-06 14:11:46.975 INFO (SyncWorker_5) [homeassistant.util.package] Attempting install of bleak==0.22.1

bdraco commented 1 month ago

There are a lot of packages being updated.

2024-06-06 14:15:18.421 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of androidtvremote2==0.1.1
2024-06-06 14:15:18.467 DEBUG (MainThread) [homeassistant.loader] Importing platforms for nut executor=['config_flow'] loop=[] took 0.06s
2024-06-06 14:15:18.631 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for Pixel 4a: 2 sent, 500 allowed, 0 errors, resets in 11:44:41
2024-06-06 14:15:23.202 INFO (MainThread) [homeassistant.components.mqtt.client] MQTT client initialized, birth message sent
2024-06-06 14:15:25.730 INFO (SyncWorker_0) [homeassistant.util.package] Attempting install of pyipp==0.16.0
2024-06-06 14:15:25.757 DEBUG (MainThread) [homeassistant.loader] Importing platforms for androidtv_remote executor=['config_flow'] loop=[] took 0.03s
2024-06-06 14:15:31.765 INFO (SyncWorker_9) [homeassistant.util.package] Attempting install of bellows==0.39.0
2024-06-06 14:15:31.805 DEBUG (MainThread) [homeassistant.loader] Importing platforms for ipp executor=['config_flow'] loop=[] took 0.09s
2024-06-06 14:15:31.828 DEBUG (MainThread) [homeassistant.loader] Importing platforms for upnp executor=['config_flow'] loop=[] took 0.07s
2024-06-06 14:15:39.321 INFO (SyncWorker_9) [homeassistant.util.package] Attempting install of zha-quirks==0.0.116
2024-06-06 14:15:46.463 INFO (SyncWorker_9) [homeassistant.util.package] Attempting install of universal-silabs-flasher==0.0.20
2024-06-06 14:15:47.882 INFO (SyncWorker_5) [homeassistant.util.package] Attempting install of habluetooth==3.1.1

This is quite unexpected with HAOS as all of these packages should be pre-installed in the container.

bdraco commented 1 month ago

Even the frontend has to be updated 2024-06-06 14:11:28.231 INFO (SyncWorker_4) [homeassistant.util.package] Attempting install of home-assistant-frontend==20240605.0

bdraco commented 1 month ago

Can you post some more information about which architecture you are using?

This doesn't look like a Home Assistant OS install, or something is very wrong with the docker container.

Nardol commented 1 month ago

Installation type is core, not OS. Issue description updated. Sorry for my mistake for the installation type, I did not check twice when I had an error at the first attempt to create the issue and the select box was set back to OS instead of core it seams.

I run Home Assistant on an Odroid N2+ using Raspbian, Bookworm. To be sure, here are all my system information:

System Information

version core-2024.6.0
installation_type Home Assistant Core
dev false
hassio false
docker false
user homeassistant
virtualenv true
python_version 3.12.3
os_name Linux
os_version 6.6.32-current-meson64
arch aarch64
timezone Europe/Paris
config_dir /home/homeassistant/config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4994 Installed Version | 1.34.0 Stage | running Available Repositories | 1463 Downloaded Repositories | 5
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 18 novembre 2024 à 01:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-2.ui.nabu.casa certificate_status | ready instance_id | 2b063662ea364ff4a192804130e23c62 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Dashboards dashboards | 3 -- | -- resources | 2 views | 7 mode | yaml
Recorder oldest_recorder_run | 5 juin 2024 à 16:52 -- | -- current_recorder_run | 6 juin 2024 à 14:51 estimated_db_size | 269.93 MiB database_engine | sqlite database_version | 3.40.1
bdraco commented 1 month ago

That makes a lot more sense

So it seems the problem here is that there are no pre-built wheels for your platform, and the pip install takes so long because it has to manually compile the native code which causes stage1 to timeout.

bdraco commented 1 month ago
diff --git a/homeassistant/setup.py b/homeassistant/setup.py
index f33ba3ebd7b..3adf3b77e70 100644
--- a/homeassistant/setup.py
+++ b/homeassistant/setup.py
@@ -565,7 +565,7 @@ async def async_process_deps_reqs(
     if failed_deps := await _async_process_dependencies(hass, config, integration):
         raise DependencyError(failed_deps)

-    async with hass.timeout.async_freeze(integration.domain):
+    async with hass.timeout.async_freeze():
         await requirements.async_get_integration_with_requirements(
             hass, integration.domain
         )

I think making the requirements install a global freeze of the timer would probably solve this issue. I'm not 100% sure on that usage though i don't think we have any other global freezes of the timeout util in the codebase