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
73.74k stars 30.85k forks source link

Global System Failure while using ESPHome add-on and updating ESP32 Cam #127040

Open francudina opened 1 month ago

francudina commented 1 month ago

The problem

Global system failure while using ESPHome add-on and updating ESP32 Cam. I started updating the remote ESP32 Cam with new firmware and accidentally disconnected its USB, and from that point my whole home assistant instance stopped working. I can still open frontend and navigate through pages but add-ons, sensors, etc. doesn't work anymore.

Here is the root cause (my guess):

Logger: homeassistant.components.homeassistant
Source: components/homeassistant/__init__.py:351
integration: Home Assistant Core Integration ([documentation](https://www.home-assistant.io/integrations/homeassistant), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+homeassistant%22))
First occurred: 16:05:37 (3 occurrences)
Last logged: 16:18:06

The system cannot reload because the configuration is not valid: File configuration.yaml not found.

Because of that also HA cannot read DB:

Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:1199
integration: Recorder ([documentation](https://www.home-assistant.io/integrations/recorder), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+recorder%22))
First occurred: 15:57:46 (1594 occurrences)
Last logged: 17:11:46

Error in database connectivity during commit: Error executing query: (sqlite3.OperationalError) disk I/O error (Background on this error at: https://sqlalche.me/e/20/e3q8). (retrying in 3 seconds)
Error in database connectivity during commit: Error executing query: (sqlite3.OperationalError) unable to open database file (Background on this error at: https://sqlalche.me/e/20/e3q8). (retrying in 3 seconds)

What version of Home Assistant Core has the issue?

2024.9.3

What was the last working version of Home Assistant Core?

2024.9.3

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

ESPHome

Link to integration documentation on our website

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

Diagnostics information

Cannot recover diagnostic info.

Example YAML snippet

YAML isn't a problem.

Anything in the logs that might be useful for us?

Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:900
integration: Recorder (documentation, issues)
First occurred: 15:57:51 (1 occurrences)
Last logged: 15:57:51

Unrecoverable sqlite3 database corruption detected: (sqlite3.DatabaseError) database disk image is malformed [SQL: UPDATE states SET last_reported_ts=? WHERE states.state_id = ?] [parameters: [(1727618205.0235295, 294851), (1727618205.02368, 294852), (1727618205.0237417, 294853), (1727618205.0237985, 294854), (1727618205.0238492, 294855), (1727618205.0238929, 294856), (1727618205.0239995, 294842), (1727618205.0240479, 294857) ... displaying 10 of 13 total bound parameter sets ... (1727618205.024319, 294861), (1727617965.6667655, 294703)]] (Background on this error at: https://sqlalche.me/e/20/4xp6)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 921, in do_executemany
sqlite3.DatabaseError: database disk image is malformed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 900, in _process_one_task_or_event_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 291, in run
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1197, in _commit_event_session_or_retry
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1223, in _commit_event_session
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2236, in _execute_internal
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1603, in orm_execute_statement
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 335, in _bulk_update
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 912, in _emit_update_statements
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 921, in do_executemany
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: UPDATE states SET last_reported_ts=? WHERE states.state_id = ?]
[parameters: [(1727618205.0235295, 294851), (1727618205.02368, 294852), (1727618205.0237417, 294853), (1727618205.0237985, 294854), (1727618205.0238492, 294855), (1727618205.0238929, 294856), (1727618205.0239995, 294842), (1727618205.0240479, 294857)  ... displaying 10 of 13 total bound parameter sets ...  (1727618205.024319, 294861), (1727617965.6667655, 294703)]]
(Background on this error at: https://sqlalche.me/e/20/4xp6)
Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:900
integration: Recorder (documentation, issues)
First occurred: 15:57:49 (1 occurrences)
Last logged: 15:57:49

SQLAlchemyError error processing task CommitTask()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 900, in _process_one_task_or_event_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 291, in run
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1197, in _commit_event_session_or_retry
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1223, in _commit_event_session
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2226, in _execute_internal
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2095, in _connection_for_bind
  File "<string>", line 2, in _connection_for_bind
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 103, in _go
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 996, in _raise_for_prerequisite_state
sqlalchemy.exc.InvalidRequestError: This session is in 'prepared' state; no further SQL can be emitted within this transaction.

Additional information

No response

home-assistant[bot] commented 1 month ago

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

Code owner commands Code owners of `homeassistant` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homeassistant` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homeassistant documentation homeassistant source (message by IssueLinks)

home-assistant[bot] commented 1 month ago

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

Code owner commands Code owners of `recorder` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign recorder` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


recorder documentation recorder source (message by IssueLinks)

home-assistant[bot] commented 1 month ago

Hey there @ottowinter, @jesserockz, @kbx81, @bdraco, mind taking a look at this issue as it has been labeled with an integration (esphome) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `esphome` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign esphome` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


esphome documentation esphome source (message by IssueLinks)