mO SharemO Share

Mosquitto database corruption after hard reset or power failure

Problem

The system is designed to be running under an UPS. Under some circumstances, an unexpected power failure may corrupt some files that are critical for the system. This is true for any computer system. Check if this applies to you by restarting mosquitto, for example like this (may differ from platform to platform).

root@Router:/ $/opt/azeti/SiteController/run_SiteController.sh start_mosquitto
Start Mosquitto daemon
1431326921: Error: Success.
1431326921: Error: Couldn't open database.

Solution

The error message implies that there is a database corruption and you need to delete the database file of mosquitto. It is ussually found in $SCPATH$/persistent, where $SCPATH$ is the path where you have installed Site Controller. In case it is not there, you will need to read your mosquitto configuration path and see where the database file for mosquitto is stored.

Please note that there might be other databases corrupted. If you identify the "database corrupted" in any of the logs, you can delete the corresponding database file that is usually located in $SCPATH$/persistent.

Part of the system information relies on the mosquitto database. In case you have not other persistence module activated (persistor daemon or data store), you might need to do some adjustments after deleting the mosquitto database. Pay special attention to the following use cases:

  • If you have an access solution, resend the codes to the location from the server.
  • If you use batteries, recalibrate the device. Battery calibration data can be redeployed from server.