The “database is locked” error indicates a problem with your sqlite database. This can happen if the database is left in an inconsistent state after a crash, or if there are problems with the disk.
One thing you can try is to dump the data from your existing db file into a new one, then swap it out. From inside your Grafana data directory (after shutting down Grafana):
if you are using the grafana/grafana docker image then the sqlite is located at /var/lib/grafana/grafana.db
Again, if you are using grafana/grafana image inside kubernetes then the sqlite is stored on a persistent-volume. Inside the container, there is no sqlite3 available.
Therefore you must copy the database out of the container or PVC on your machine, clone it there and copy it back.
Hey, I got the same issue “database is locked” 2 weeks back, and used the steps for cloning that u mentioned and it solved the error, but now it again came and I had to again implement the cloning to make it right. There was no Grafana crash or anything issue recent, so how to solve this permanently?