1. Home
  2. Framework
  3. Repair Snapt SQLite database

Repair Snapt SQLite database

If you are receiving an error in Snapt with the keywords:

Error example

There has been a serious error: SQLSTATE then you likely have a crashed or corrupted SQLite database.

What is SQLite to Snapt?

Snapt uses two SQLite databases – one for Snapt information and one for logging data.

These are flat file databases similar to MSSQL or MySQL that we use to store our configuration data, preferences, and then logging for all the modules.

These can be marked as “crashed” should you lose power while writing, or something else goes wrong. They can also lose tables in the event of a serious consistency failure.

Finding your SQLite databases

These are located in the “db/” folder in your Snapt install directory – typically “/srv/www/htdocs/db/” or “/usr/local/snapt/program/db/”. You can check by running the following:

ls -l /srv/www/htdocs/db
ls -l /usr/local/snapt/program/db

You are looking for the folder that has your snapt.db, log.db and potentially other .db files.

Repairing the databases

Note: the following commands must be run as the root user, please run this command to change to root –

su -

You can repair them with the following command set. This will move them to -broken and then try to create them with clean new versions –

mv log.db log-broken.db
echo ".dump" | sqlite3 log-broken.db | sqlite3 log.db

mv waf.db waf-broken.db
echo ".dump" | sqlite3 waf-broken.db | sqlite3 waf.db

mv snapt.db snapt-broken.db
echo ".dump" | sqlite3 snapt-broken.db | sqlite3 snapt.db

chmod 777 log.db waf.db snapt.db

Checking the status

Now you can go to Reports -> Dashboard and then the Database Status tab in the user interface. You should see a status of Good and your various tables below that.

Updated on March 15, 2019


Was this article helpful?

Related Articles