I am encountering an issue while starting Metabase. The application fails during initialization when attempting to connect to the default H2 application database.
The error appears consistently on startup, and Metabase shuts down immediately after the failure.
Error Details
Metabase Initialization FAILED
Unable to connect to Metabase h2 DB
Caused by:
org.h2.jdbc.JdbcSQLNonTransientConnectionException:
Database may be already in use: "/metabase.db/metabase.db.mv.db"
Caused by:
org.h2.mvstore.MVStoreException:
The file is locked: /metabase.db/metabase.db.mv.db
First, check that there isn’t a copy of Metabase already running.
If there isn’t, perform this procedure to unlock the database (yes its “corrupted” in this state):
DO NOT use H2 for the app database for any installation you care about. It WILL crash and eat your app database eventually.
This is Super Duper Important if you are running Metabase in a container: disable health checks as the container frameworks tend to carelessly kill -9 apps for flimsy reasons and it will break the database if killed willy nilly, especially during upgrades. A proper app database will resist the damage somewhat.