H2 DB release-locks fails

Hello,
I recently realized the service I created to run metabase on Ubuntu was not using mysql but h2.
I thought defining the variable globally with export was enough to let the service use them, but it seems like I needed to put them in /etc/default/metabase.

Anyway, right now I am trying to properly do the load-from-h2.

It fails with this :
Command failed with exception: ERROR Set up h2 source database and run migrations...: Database has migration lock; cannot run migrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.

And trying to do java -jar metabase.jar migrate release-locks returns this error :

Command failed with exception: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Error executing SQL UPDATE "PUBLIC"."DATABASECHANGELOGLOCK" SET "LOCKED" = TRUE, "LOCKEDBY" = 'ServerName(2a01:4f8:c013:19f6:0:0:0:1%eth0)', "LOCKGRANTED" = NOW() WHERE "ID" = 1 AND "LOCKED" = FALSE: The database is read only; SQL statement:
UPDATE "PUBLIC"."DATABASECHANGELOGLOCK" SET "LOCKED" = TRUE, "LOCKEDBY" = 'ServerName(2a01:4f8:c013:19f6:0:0:0:1%eth0)', "LOCKGRANTED" = NOW() WHERE "ID" = 1 AND "LOCKED" = FALSE [90097-214]

On another server it is the same error but with LOCKEDBY=NULL

Another question while I am here.
Is there any way in the /etc/default/metabase where I need to set environment variables to not write the db password and still make the service run properly ? I don't like the idea of writing any password without any encryption.

check why "The database is read only".

About

Is there any way in the /etc/default/metabase where I need to set environment variables to not write the db password and still make the service run properly ? I don't like the idea of writing any password without any encryption.

you need a secrets manager that runs locally, much like Kubernetes does with the secrets

1 Like

Thnkas, your advice helped me, seems like I just didn't think about launching the command with sudo.
It worked fine with sudo java -jar metabase.jar migrate release-locks

For information, beware, for the load-from-h2 function, the sudo prevents the connexion to the production base and leads to h2 to h2 so to an error.

For the secret part I realized the data in the metabase db itself is not critical so I just created a user with privileges only on the metabase db.