Home Assistant Community

Recorder, Logbook and History failed

#1

Hi. Updated to v0.85.1 and not recorder, logbook and history are not leading.

The system log is full of warnings and errors also…

Setup failed for logbook: Could not set up all dependencies.
4:26 AM setup.py (ERROR)

Unable to set up dependencies of logbook. Setup failed for dependencies: recorder
4:26 AM setup.py (ERROR)

Setup failed for history: Could not set up all dependencies.
4:26 AM setup.py (ERROR)

Unable to set up dependencies of history. Setup failed for dependencies: recorder
4:26 AM setup.py (ERROR)

Setup failed for recorder: Component failed to initialize.
4:26 AM setup.py (ERROR)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Setup of recorder is taking over 10 seconds.
4:26 AM util/async_.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
4:26 AM components/recorder/__init__.py (ERROR)

Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'CREATE INDEX ix_states_entity_id ON states (entity_id)'] (Background on this error at: http://sqlalche.me/e/4xp6)
4:26 AM components/recorder/util.py (ERROR)

Database is about to upgrade. Schema version: 6
4:26 AM components/recorder/migration.py (WARNING)

Can anyone help me to fix this, please?

1 Like
#2

Delete your home-assistant_v2.db file and restart.

#3

Hi… Thanks… I will try that.

How can I do this remotely via terminal?

#4

Thank you so much. It worked… :grinning:

#5

I have done that a few times. However after a couple of days it stops working.

#6

Try the mariadb addon instead of using the built in sql db. Or if you are experiencing other stability issues, replace your SD card.

#7

I am running in a docker on Ubuntu server, can i use an sql server outside of the built in one?

#8

Yes you can.

I suspect you might have some other problem though.

#9

Why do you suspect that?

#10

Because these problems tend to occur on raspberry pi’s with low write endurance SD cards. It does not sound like that is the type of platform you are running:

However MariaDB does (anecdotally) seem to be more reliable than the default SQLite db.

#11

MariaDB runs anywhere between 15-30 seconds for me. I’ll likely try influxdb as well in case it’s way faster.

Feel free to vote for this enhancement and alleviate some of the slow SQLite DB behavior.