After installing Joplin : "Error: Postgres version not supported"

What type of hardware are you using: Old laptop or computer
What YunoHost version are you running: 12
What app is this about: Joplin

Describe your issue

Hi everyone! I tried to install Joplin after migrating to Yunohost 12 and I cannot access the app. I get a 502 Bad gateway.
I checked the service and the one for Joplin is “failed”. I tried to restart it with no success.

Apparently, it would be related to Postgres version that is not supported.

After the migration, I got the 500 Internal server error but I read somewhere on the forum that it was normal. I refreshed the page after + log in and no problem.

I had to go back to the migration section and migrate “part” (i don’t remember what it was) of the migration that were not applied the first time.

Perhaps the Postgres version wasn’t updated correctly during the migration ?

Thanks.

Share relevant logs or error messages

Save New Duplicate & Edit Just Text Twitter
LOGFILE: journalctl

Nov 01 11:38:10 yarn[176023]: 2024-11-01 11:38:10: App: Trying to connect to database...
Nov 01 11:38:10 yarn[176023]: 2024-11-01 11:38:10: App: Connection check: { latestMigration: null, isCreated: false, error: null }
Nov 01 11:38:10 yarn[176023]: Error: Postgres version not supported: PostgreSQL 11.18 (Debian 11.18-0+deb10u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit. Min required version is: 12.0
Nov 01 11:38:10 yarn[176023]:     at versionCheck (/var/www/joplin/packages/server/src/db.ts:470:64)
Nov 01 11:38:10 yarn[176023]:     at processTicksAndRejections (node:internal/process/task_queues:95:5)
Nov 01 11:38:10 yarn[176023]:     at main (/var/www/joplin/packages/server/src/app.ts:327:3)
Nov 01 11:38:10 systemd[1]: joplin.service: Main process exited, code=exited, status=1/FAILURE
Nov 01 11:38:10 systemd[1]: joplin.service: Failed with result 'exit-code'.
Nov 01 11:38:10 systemd[1]: joplin.service: Consumed 4.381s CPU time.
-- Boot 90cf815c576443f4873d640d32f7538a --
Nov 02 11:51:26 systemd[1]: Started joplin.service - Joplin server.
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Starting server v3.1.0 (prod) on port 22300 and PID 12421...
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Checking for time drift using NTP server: pool.ntp.org:123
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: NTP time offset: -50ms
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Running in Docker: false
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Public base URL: https://joplin.macaques.ca
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: API base URL: https://joplin.macaques.ca
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: User content base URL: https://joplin.macaques.ca
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Log dir: /var/www/joplin/packages/server/logs
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: DB Config: {
Nov 02 11:51:30 yarn[12421]:   client: 'pg',
Nov 02 11:51:30 yarn[12421]:   name: 'joplin',
Nov 02 11:51:30 yarn[12421]:   slowQueryLogEnabled: false,
Nov 02 11:51:30 yarn[12421]:   slowQueryLogMinDuration: 1000,
Nov 02 11:51:30 yarn[12421]:   autoMigration: true,
Nov 02 11:51:30 yarn[12421]:   user: 'joplin',
Nov 02 11:51:30 yarn[12421]:   password: '********',
Nov 02 11:51:30 yarn[12421]:   port: 5432,
Nov 02 11:51:30 yarn[12421]:   host: 'localhost'
Nov 02 11:51:30 yarn[12421]: }
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Mailer Config: {
Nov 02 11:51:30 yarn[12421]:   enabled: true,
Nov 02 11:51:30 yarn[12421]:   host: 'localhost',
Nov 02 11:51:30 yarn[12421]:   port: 25,
Nov 02 11:51:30 yarn[12421]:   security: 'tls',
Nov 02 11:51:30 yarn[12421]:   authUser: 'joplin',
Nov 02 11:51:30 yarn[12421]:   authPassword: '********',
Nov 02 11:51:30 yarn[12421]:   noReplyName: 'joplin',
Nov 02 11:51:30 yarn[12421]:   noReplyEmail: 'reply@joplin.macaques.ca'
Nov 02 11:51:30 yarn[12421]: }
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Content driver: { type: 1 }
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Content driver (fallback): null
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Trying to connect to database...
Nov 02 11:51:30 yarn[12421]: 2024-11-02 11:51:30: App: Connection check: { latestMigration: null, isCreated: false, error: null }
Nov 02 11:51:30 yarn[12421]: Error: Postgres version not supported: PostgreSQL 11.18 (Debian 11.18-0+deb10u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit. Min required version is: 12.0
Nov 02 11:51:30 yarn[12421]:     at versionCheck (/var/www/joplin/packages/server/src/db.ts:470:64)
Nov 02 11:51:30 yarn[12421]:     at processTicksAndRejections (node:internal/process/task_queues:95:5)
Nov 02 11:51:30 yarn[12421]:     at main (/var/www/joplin/packages/server/src/app.ts:327:3)
Nov 02 11:51:30 systemd[1]: joplin.service: Main process exited, code=exited, status=1/FAILURE
Nov 02 11:51:30 systemd[1]: joplin.service: Failed with result 'exit-code'.
Nov 02 11:51:30 systemd[1]: joplin.service: Consumed 4.366s CPU time.

Can you share the output of sudo pg_listclusters ?

Hi @Aleks !

ssh admin@<domain>
admin@<domain>'s password:
Linux <domain> 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Nov  1 18:07:26 2024 from <IP>
admin@<domain>:~$ sudo pg_listclusters
[sudo] password for admin:
sudo: pg_listclusters: command not found
admin@<domain>:~$

Normal?

It was :

$ sudo pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
11  main    5432 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
15  main    5433 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log

I don’t have the right version apparently : postgresql-15

Hmfokay so let’s look at : sudo aptitude why postgresql-11

sudo aptitude why postgresql-11
i   joplin-ynh-deps      Depends  postgresql-client
i A postgresql-client-11 Provides postgresql-client
i A postgresql-client-11 Suggests postgresql-11

Hmf okay, postgresql-client-11 Provides postgresql-client … but so does version 15 …

So let’s try to see what apt remove postgresql-11 --dry-run says, does it warn about important stuff that would get removed besides postgresql 11 ?

apt remove postgresql-11 --dry-run
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libicu63 libldap-2.4-2 libllvm7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  postgresql-11
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Remv postgresql-11 [11.18-0+deb10u1]

Alrighty it should be fine to remove it then, using sudo apt remove postgresql-11

And then we should check with sudo pg_lsclusters that postgresql 15 now listens to port 5432

Executed : sudo apt remove postgresql-11

After :

sudo pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
11  main    5432 down,binaries_missing postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
15  main    5433 online                postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log

But instance Yunohost seems to be down now…

hmmmoay so let’s try somthing else by changing the port in the config ? Using:

sudo sed 's/5432/5499/g' -i /etc/postgresql/11/main/postgresql.conf

and

sudo sed 's/5433/5432/g' -i /etc/postgresql/15/main/postgresql.conf

and then sudo systemctl restart postgresql and sudo pg_lsclusters to confirm the change ?

Back online!
I restarted Joplin service.

There is a new error regarding user joplin that doesn’t exist. It should be with my main user I guess.

Perhaps I should reinstall the app ?

Logs :
https://paste.yunohost.org/qiqefirero

After re-installing Joplin, everything works !

Thank you @Aleks !

Complete solution :

  1. Inspect : sudo pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
11  main    5432 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
15  main    5433 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
  1. sudo aptitude why postgresql-11
i   joplin-ynh-deps      Depends  postgresql-client
i A postgresql-client-11 Provides postgresql-client
i A postgresql-client-11 Suggests postgresql-11
  1. apt remove postgresql-11 --dry-run
apt remove postgresql-11 --dry-run
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libicu63 libldap-2.4-2 libllvm7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  postgresql-11
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Remv postgresql-11 [11.18-0+deb10u1]
  1. Remove wrong version of postgresql : sudo apt remove postgresql-11
  2. Inspect : sudo pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
11  main    5432 down,binaries_missing postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
15  main    5433 online                postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
  1. If no more access to Yunohost instance, try :
  2. sudo sed ‘s/5432/5499/g’ -i /etc/postgresql/11/main/postgresql.conf
  3. sudo sed ‘s/5433/5432/g’ -i /etc/postgresql/15/main/postgresql.conf
  4. sudo systemctl restart postgresql
  5. sudo pg_lsclusters
  6. Yunohost instance should be back online
  7. Reinstall Joplin
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.