Encountered this error after upgrade

Guys, i encountered this error after upgrade HA. please help. I am new. many thanks!!

2021-02-11 23:48:30 WARNING (Recorder) [homeassistant.components.recorder.migration] Database is about to upgrade. Schema version: 9

2021-02-11 23:48:30 WARNING (Recorder) [homeassistant.components.recorder.migration] Adding index `ix_states_old_state_id` to database. Note: this can take several minutes on large databases and slow computers. Please be patient!

2021-02-11 23:48:30 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed

[SQL: CREATE INDEX ix_states_old_state_id ON states (old_state_id)]

(Background on this error at: http://sqlalche.me/e/13/4xp6)

2021-02-11 23:48:30 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed

[SQL: CREATE INDEX ix_states_old_state_id ON states (old_state_id)]

(Background on this error at: http://sqlalche.me/e/13/4xp6) (retrying in 3 seconds)

2021-02-11 23:48:42 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.

Simple solution: remove file home-assistant_v2.db and restart.

You will loose your entities state‘s history. Actually, you already lost the history, as the database file is f*cked.

2 Likes

Thanks! it worked.

1 Like

If you’re using an RPi with a SD card I recommend getting the best one you can or you will see this again. I used a Sandisk Extreme Pro for 2+ years with much success. Search the forums for SD card fail to see what I mean.

1 Like

thanks for the tip. i will get one.