Select Page
This entry has been published on 2017-11-03 and may be out of date.

Last Updated on 2017-11-03.

[:en]Sometimes Kodi’s internal SQLite databases get damaged, maybe due to corrupted memory cards. This leads to strange results for certain addons or the repository list, e.g. addons don’t work, are shown multiple times or as damaged, no updates etc.

To make sure the DB causes the issue, have a look at kodi.log, e.g. under /storage/.kodi/temp/kodi.log. It could contain logs like

13:25:06 5264529.500000 T:1758819392 NOTICE: Thread FileCache start, auto delete: false

13:25:07 5264530.000000 T:1800766528   ERROR: SQL: The database disk image is malformed

Query: SELECT addon.*,       broken.reason,       addonextra.key, addonextra.value,       dependencies.addon, dependenc

13:25:07 5264530.000000 T:1800766528   ERROR: GetAddon failed on addon 161287

13:25:07 5264530.500000 T:1800766528   ERROR: SQL: The database disk image is malformed

In most cases these DBs can be repaired with simple commands.

E.g. for OpenELEC or LibreELEC, use these commands to repair the local Addons DB via SSH:

cd ~/.kodi/userdata/Database
sqlite3 AddonsXX.db #replace XX with the actually existing file; can also be several files
sqlite> .mode insert
sqlite> .output dump.sql
sqlite> .dump
sqlite> .exit

# edit dump.sql
echo -n '' > AddonsXX.db #replace XX like above
sqlite3 AddonsXX.db #same here
sqlite> .read dump.sql
sqlite> .exit
rm dump.sql

Same procedure works for the other kinds of DBs (videos, EPG, …).

Reference[:]