Database error

Hi,

I installed Joplin in my synology with docker (with Portainer) following this article one month ago.

It worked well until yesterday. The container Joplin-db-1 keeps restarting. Log of Joplin-db-1 container shows:

PostgreSQL Database directory appears to contain a database; Skipping initialization

2022-10-18 04:59:12.704 UTC [1] FATAL: database files are incompatible with server

2022-10-18 04:59:12.704 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 14, which is not compatible with this version 15.0 (Debian 15.0-1.pgdg110+1).

And Docker’s logs show:

Start container joplin-db-1 failed: {"message":"failed to initialize logging driver: database is locked"}.

Could you kindly figure out what’s wrong? Thanks!

You have made a update from Postgres 14 to 15 in your docker environment!
Yuse again a docker postgres 14 container and I think everything works again.

thank you! I know what to do now.

Hey man,
Did you solve it ?
I have the same issue ... how did you do it ?
Thanks.

Allrighty !!
I just adress my problem ... actually it is pretty simple :slight_smile:
Stop your related containers
Edit your stack by adding the version that works to the database type name for exemple :
image: postgres:14.5
Don't forget to do it on each line where there is
image : postgres
That was the solution for me, both Joplin and firefly failed after update but now since the 14.5 version in written in the stack it will be the right version to be pulled.
A least until I update the stacks with the next version of postgresql :slight_smile:
Bless you all !

Yes , I am an atheist who bless people when he is happy !! we exist !!

Joplin works perfectly with PostgreSQL 15. The problem you have here is that you can't simply update your postgres container between two major postgres updates. You have to export your v14 database, create a new v15 container, and then re import the database in the new container. Here is how I'm doing it:

  1. docker compose down
  2. docker compose up -d db
  3. docker compose exec -it db pg_dumpall -U joplin > data.sql
  4. docker compose down
  5. Create a new data directory :
    • mv data data.bak
    • mkdir data
  6. Update the tag you are using (postgres:14-alpine → postgres:15-alpine) in docker-compose.yml
  7. docker compose up -d db
  8. docker compose exec -T db psql -U joplin < data.sql
  9. docker compose down
  10. docker compose up -d
  11. Check everything runs correctly
  12. rm -rf data.bak
  13. rm -rf data.sql
1 Like