Beschädigte Datenbank

Ich hab seit kurzem das Problem, dass meine SQL Datenbank in HA beschädigt ist.
Ich denke das hat damit zutun, seitdem ich Auto-Updates auf google drive aktiviert habe.
Jedenfalls hatte ich in den letzten 3 Tagen Probleme HA zu bedienen bzw. konnte nicht mehr alles ausgeführt werden (keine Verläufe, fehlende aktualisierte Entitäten etc., config.yaml Fehlermeldungen …)
Es half dann nur noch Strom wegnehmen und neustarten lassen, danach ging es wieder.

Ich habe bei google gefunden, dass einige auch schon das Problem hatte, leider nur im englisch sprachigem Forum.
Der Database Error kommt wohl daher das während des Backups Daten in die Database geschrieben werden und die dadurch corrupt ist.
Oder meine SSD fällt langsam aus …

Jedenfalls weiß ich nicht so recht was ich jetzt machen soll.
HA komplett neuaufsetzen und ein Backup einspielen?
Aber das könnte ja auch schon corrupt sein.

Meinst du Auto-Backup?
Ich lasse automatisch Backups in OneDrive machen. Eigentlich sollte dabei nichts passieren. Wie hast du dein Auto-Backup eingerichtet?

Wenn nichts mehr geht, würde ich das so empfehlen.
Lad dir das Backup mal runter, dann kannst du reinschauen.

Achja sorry Backup natürlich. Hab es über Home Assistant Google Drive Backup eingerichtet.
Aber ich bild mir ein seitdem kommen die Errors.

Es geht ja nach einem Hardreset wieder bis dann wieder die Errors der Datenbank kommen.
Wie meinst du runterladen und reinschauen?

Welche Fehlermeldungen bekommst du?

Ich sehe die Logmeldungen seit dem Hardreset nicht mehr, wo kann ich die denn nochmal finden?
Aber es waren einige …

Ok hab sie jetzt noch ausfindig gemacht:

Logger: [homeassistant.components.hassio](http://homeassistant.components.hassio)
Source: helpers/[update_coordinator.py:332](http://update_coordinator.py:332)
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 13:13:58 (1 occurrences)
Last logged: 13:13:58
Error fetching hassio data: Error on Supervisor API:
Logger: homeassistant.components.hassio
Source: helpers/update_coordinator.py:332
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 13:13:58 (1 occurrences)
Last logged: 13:13:58

Error fetching hassio data: Error on Supervisor API:
Logger: homeassistant.components.recorder.util
Source: components/recorder/util.py:235
Integration: Recorder (documentation, issues)
First occurred: 13:13:58 (3 occurrences)
Last logged: 13:13:58

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: SELECT state_attributes.attributes_id, state_attributes.shared_attrs FROM state_attributes WHERE state_attributes.hash IN (?)] [parameters: (3303323990,)] (Background on this error at: https://sqlalche.me/e/20/4xp6)
Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:912
Integration: Recorder (documentation, issues)
First occurred: 13:13:58 (1 occurrences)
Last logged: 13:13:58

Unrecoverable sqlite3 database corruption detected: (sqlite3.DatabaseError) database disk image is malformed [SQL: SELECT state_attributes.attributes_id, state_attributes.shared_attrs FROM state_attributes WHERE state_attributes.hash IN (?)] [parameters: (3303323990,)] (Background on this error at: https://sqlalche.me/e/20/4xp6)
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
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 912, in _process_one_task_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 281, in run
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1020, in _process_one_event
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1131, in _process_state_changed_event_into_session
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 77, in get
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 98, in get_many
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 111, in _load_from_hashes
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 230, in execute_stmt_lambda_element
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/lambdas.py", line 604, in _execute_on_connection
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: SELECT state_attributes.attributes_id, state_attributes.shared_attrs
FROM state_attributes
WHERE state_attributes.hash IN (?)]
[parameters: (3303323990,)]
(Background on this error at: https://sqlalche.me/e/20/4xp6)
Logger: homeassistant.components.recorder.util
Source: components/recorder/util.py:347
Integration: Recorder (documentation, issues)
First occurred: 13:13:58 (1 occurrences)
Last logged: 13:13:58

The system will rename the corrupt database file //config/home-assistant_v2.db to //config/home-assistant_v2.db.corrupt.2024-01-05T12:13:58.984439+00:00 in order to allow startup to proceed
Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:901
Integration: Recorder (documentation, issues)
First occurred: 13:13:58 (1 occurrences)
Last logged: 13:13:58

Error while processing event EventTask(event=<Event state_changed[L]: entity_id=update.home_assistant_supervisor_update, old_state=<state update.home_assistant_supervisor_update=off; auto_update=True, installed_version=2023.12.0, in_progress=False, latest_version=2023.12.0, release_summary=None, release_url=https://github.com/home-assistant/supervisor/releases/tag/2023.12.0, skipped_version=None, title=Home Assistant Supervisor, entity_picture=https://brands.home-assistant.io/hassio/icon.png, friendly_name=Home Assistant Supervisor Update, supported_features=1 @ 2024-01-04T12:08:57.196383+01:00>, new_state=<state update.home_assistant_supervisor_update=unavailable; entity_picture=https://brands.home-assistant.io/hassio/icon.png, friendly_name=Home Assistant Supervisor Update, supported_features=1 @ 2024-01-05T13:13:58.713850+01:00>>): [Errno 30] Read-only file system: '//config/home-assistant_v2.db' -> '//config/home-assistant_v2.db.corrupt.2024-01-05T12:13:58.984439+00:00'
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
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 912, in _process_one_task_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 281, in run
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1020, in _process_one_event
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1131, in _process_state_changed_event_into_session
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 77, in get
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 98, in get_many
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/state_attributes.py", line 111, in _load_from_hashes
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 230, in execute_stmt_lambda_element
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/lambdas.py", line 604, in _execute_on_connection
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: SELECT state_attributes.attributes_id, state_attributes.shared_attrs
FROM state_attributes
WHERE state_attributes.hash IN (?)]
[parameters: (3303323990,)]
(Background on this error at: https://sqlalche.me/e/20/4xp6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 901, in _guarded_process_one_task_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 914, in _process_one_task_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1152, in _handle_database_error
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1208, in _handle_sqlite_corruption
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 360, in move_away_broken_database
OSError: [Errno 30] Read-only file system: '//config/home-assistant_v2.db' -> '//config/home-assistant_v2.db.corrupt.2024-01-05T12:13:58.984439+00:00'