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
70k stars 29.08k forks source link

critical core issue with frontend on 2022.1.0.dev20211214 #61756

Closed Mariusthvdb closed 2 years ago

Mariusthvdb commented 2 years ago

The problem

updated to latest dev https://github.com/home-assistant/core/commits/dev but got a safe mode boot... all kinds of errors like logged below

system returned to 2022.1.0.dev20211213 automatically though so thats ok...

What version of Home Assistant Core has the issue?

2022.1.0.dev20211214

What was the last working version of Home Assistant Core?

2022.1.0.dev20211213

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Frontend ?

Link to integration documentation on our website

https://www.home-assistant.io/integrations/frontend/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)

2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.

2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.

2021-12-14 09:13:47 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of my. Setup failed for dependencies: frontend
2021-12-14 09:13:47 ERROR (MainThread) [homeassistant.setup] Setup failed for my: Could not set up all dependencies.

2021-12-14 09:13:48 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of browser_mod. Setup failed for dependencies: frontend
2021-12-14 09:13:48 ERROR (MainThread) [homeassistant.setup] Setup failed for browser_mod: Could not set up all dependencies.

2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of favicon. Setup failed for dependencies: frontend
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Setup failed for favicon: Could not set up all dependencies.

2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of map. Setup failed for dependencies: frontend
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Setup failed for map: Could not set up all dependencies.
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of fontawesome. Setup failed for dependencies: frontend
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Setup failed for fontawesome: Could not set up all dependencies.
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: frontend
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not set up all dependencies.
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of panel_custom. Setup failed for dependencies: frontend
2021-12-14 09:13:49 ERROR (MainThread) [homeassistant.setup] Setup failed for panel_custom: Could not set up all dependencies.

2021-12-14 09:15:07 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mobile_app. Setup failed for dependencies: person
2021-12-14 09:15:07 ERROR (MainThread) [homeassistant.setup] Setup failed for mobile_app: Could not set up all dependencies.

leading up to

2021-12-14 09:15:28 WARNING (MainThread) [homeassistant.bootstrap] Detected that frontend did not load. Activating safe mode

and going on after that:

2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)

2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.
2021-12-14 09:15:29 INFO (MainThread) [homeassistant.setup] Setup of domain analytics took 0.0 seconds
2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
2021-12-14 09:15:29 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.

most awkward is this:

2021-12-14 09:15:29 INFO (MainThread) [homeassistant.setup] Setting up cloud
2021-12-14 09:15:29 WARNING (MainThread) [hass_nabucasa.iot] Connection closed: Received non-Text message: 8
2021-12-14 09:15:30 ERROR (MainThread) [hass_nabucasa.iot] You have been logged out from Home Assistant cloud: Logged in from another instance.

and ofc this:

2021-12-14 09:15:31 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of safe_mode. Setup failed for dependencies: frontend
2021-12-14 09:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for safe_mode: Could not set up all dependencies.
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: browser_mod/connect
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: get_panels
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: frontend/get_themes
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: frontend/get_user_data
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: frontend/get_translations
2021-12-14 09:15:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: frontend/get_translations
2021-12-14 09:15:36 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547433330288] Received invalid command: browser_mod/update


### Additional information

_No response_
probot-home-assistant[bot] commented 2 years ago

frontend documentation frontend source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @home-assistant/frontend, mind taking a look at this issue as it has been labeled with an integration (frontend) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

bdraco commented 2 years ago

This is from the Pillow update

2021-12-14 09:13:40 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)

Mariusthvdb commented 2 years ago

which is what? dont think I recognize that in my system ;-)

could this have anything to do with either fontawesome or favicon custom components?

bdraco commented 2 years ago

https://github.com/home-assistant/core/pull/61661

I had to install pillow manually to get my dev env to work again

Mariusthvdb commented 2 years ago

yeah, well I am on OS so will have to wait for a fix... still I dont understand what happened, or why this Pillow has anything to do with the config at all.

I did test adding a person entity via the UI (using Yaml mode but liked to try that bit of config option) and selected an image for that person too. Upon which a new folder in my /config was created: /config/image where 3 maps have been made for the images.

I deleted the person entity after that, and have no other UI configured entity with an image from the ui.

Maybe I should simply delete that /config/image and try again?

nohn commented 2 years ago

Any idea how to reproduce this? For me it works with 8fc69b7242 on Ubuntu 20.04 (clean pull):

script/setup source venv/bin/activate hass -c config

=> Boots without any issues in the log or the frontend.

Also setting up the various picture entities, uploading and cropping an image to an area works.

ludeeus commented 2 years ago

It seems to be limited to our container-based installations

nohn commented 2 years ago

How to build those? A naive

docker build . -t homeassistant

fails with

base name (${BUILD_FROM}) should not be blank

Mariusthvdb commented 2 years ago

Also setting up the various picture entities, uploading and cropping an image to an area work

I do remember that was one of the reasons I deleted the UI created person entity: couldn't get the crop function to work, and ended up with black images. Didn't think anything of it at that time, because no other harm done. Now I see the issue ... sorry I didnt mention before.

nohn commented 2 years ago

@Mariusthvdb according to https://github.com/home-assistant/core/issues/61756#issuecomment-993422811 it's a bit more complex and apparently only occurs in containerized environments.

Mariusthvdb commented 2 years ago

right, not sure about any of this. btw, tried to delete the folder /config/image and update again to todays dev 1214, but it isn't available anymore ;-)

with #61661 is his now solved?

nohn commented 2 years ago

@Mariusthvdb no, unfortunately it is not solved. The change (#61661) that caused this issue (#61756) was reverted but should be re-applied in the future because of security concerns.

Therefore, we first need to find a way to reproduce this.

Mariusthvdb commented 2 years ago

unfortunately I dont see the update to dev 1214 anymore, so I can not try again. It was the only thing needed to produce the issue ;-)

I do see that I can update from OS: You have 8.0.dev20211114 installed. Click update to update to version 8.0.dev20211213

which must be a fluke too ...

crossing my fingers here

nohn commented 2 years ago

As written above, it seems only to happen with containerized versions of Home Assistant (https://github.com/home-assistant/core/issues/61756#issuecomment-993422811), but I couldn't find documentation how to build a containerized version of Home Assistant like the official images and the intuitive way doesn't work.

ch0chi commented 2 years ago

I was able to reproduce this. I was previously running v2021.11.4 of HA on a raspberry pi 3b+ inside of a docker container. I decided to pull and use the latest tagged image (2022.1.0.dev20211214). After building the container, I noticed my frontend of HA wasn't working. Checked the logs, and they are identical to what OP posted.

NathanBeirens commented 2 years ago

Running in docker on a pi4 image id c6e1e0ac2abb (I run :latest tags) I get a similar error:

[homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)
[homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
[homeassistant.setup] Setup failed for person: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
[homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
[homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of my. Setup failed for dependencies: frontend
[homeassistant.setup] Setup failed for my: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of map. Setup failed for dependencies: frontend
[homeassistant.setup] Setup failed for map: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: frontend
[homeassistant.setup] Setup failed for logbook: Could not set up all dependencies.
[homeassistant.setup] Unable to set up dependencies of mobile_app. Setup failed for dependencies: person
[homeassistant.setup] Setup failed for mobile_app: Could not set up all dependencies.

after this I ran :2021.12.1 and everything is starting back up again.

syedair commented 2 years ago

I faced an issue on this release(2022.1.0.dev20211214) too. My installation was complaining about the X-Forwarded-For header and wasn’t recognizing the already working trusted proxy.

I have reverted back to the previous version (2022.1.0.dev20211213) and it’s running fine.

Mariusthvdb commented 2 years ago

thanks Martin, can confirm this is now resolved. running Home Assistant 2022.1.0.dev20211215 just nicely.