Error upgrading Passbolt-CE and PostgreSQL together

Checklist
I have read intro post: https://community.passbolt.com/t/about-the-installation-issues-category/12
I have read the tutorials, help and searched for similar issues
I provide relevant information about my server (component names and versions, etc.)
I provide a copy of my logs and healthcheck
I describe the steps I have taken to trouble shoot the problem
I describe the steps on how to reproduce the issue

Hello,

as usual I was updating my Passbolt-CE installation through apt on my Debian Trixie installed with extrepo.

Unfortunately this time there was also a PostgreSQL (my passbolt backend) update in the queue, and it didn’t come up in time for passbolt update.

so i got below error:

Setting up passbolt-ce-server (5.12.0-1) ...
Installing new version of config file /etc/passbolt/Migrations/20200501182000_V2130ReconcileLoginHistory.php ...
Installing new version of config file /etc/passbolt/app.default.php ...
Installing new version of config file /etc/passbolt/app.php ...
Installing new version of config file /etc/passbolt/bootstrap.php ...
Installing new version of config file /etc/passbolt/default.php ...
Installing new version of config file /etc/passbolt/requirements.php ...
Installing new version of config file /etc/passbolt/version.php ...

     ____                  __          ____  
    / __ \____  _____ ____/ /_  ____  / / /_ 
   / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
  / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
 /_/    \__,_/____/____/_.___/\____/_/\__/   

 Open source password manager for teams
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
 Running migration scripts.
-------------------------------------------------------------------------------
using migration paths 
 - /etc/passbolt/Migrations
using seed paths 
e[31m2026-05-15 03:34:02 error: [InvalidArgumentException] There was a problem connecting to the database: SQLSTATE[08006] [7] connection to server at "localhost" (::1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections? in /usr/share/php/passbolt/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 114
Caused by: [PDOException] SQLSTATE[08006] [7] connection to server at "localhost" (::1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections? in /usr/share/php/passbolt/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 102e[0m
e[31m2026-05-15 03:34:02 error: Could not connect to Database.e[0m
..........
<!DOCTYPE html>
<html class="passbolt no-js no-passboltplugin version" lang="en">
<head>
    <meta charset="utf-8">
    <title>Passbolt | Error</title>
<div id="container" class="error page error-500">
<div class="grid">
    <div class="row">
        <h2>An Internal Error Has Occurred</h2>
        <p class="error">
            An Internal Error Has Occurred.        </p>
    </div>
    </div>
......
dpkg: error processing package passbolt-ce-server (--configure):
 installed passbolt-ce-server package post-installation script subprocess returned error exit status 1

Errors were encountered while processing:
 passbolt-ce-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

and now

sudo -H -u www-data /usr/share/php/passbolt/bin/cake passbolt healthcheck

shows:

…

[FAIL] The database schema is not up to date.

…

could someone help me in trying to solve the issue ? manually run a schema upgrade script ?

thanks a lot

G’day Aspx1981.

That error is a race between apt’s configure order and the PostgreSQL service restart. When apt upgraded both packages in the same run, it tried to configure passbolt-ce-server while PostgreSQL was still mid-restart. The postinst script ran cake passbolt migrate, got “Connection refused” on port 5432, and bailed out early. dpkg left the package half-configured: new 5.12 PHP code is on disk, schema changes were not applied.

First, confirm PostgreSQL is up and accepting connections:

sudo systemctl status postgresql

Then let dpkg finish what it started:

sudo dpkg --configure -a

That re-runs the postinst, which runs the migration, clears the cache, and finishes the JWT key check. The schema check should come back passing once it’s done.

If dpkg --configure -a fails for any reason, you can run the steps manually:

sudo su -s /bin/bash -c "/usr/share/php/passbolt/bin/cake passbolt migrate" www-data
sudo su -s /bin/bash -c "/usr/share/php/passbolt/bin/cake cache clear_all" www-data

The “An Internal Error Has Occurred” HTML page you saw is just the site throwing a 500 because the new PHP code was running against an old schema. It will clear up once the migration runs.

For next time: the documented apt upgrade sequence runs passbolt’s configure step in isolation before touching anything else, which avoids this race:

https://www.passbolt.com/docs/hosting/update/debian/#3-upgrade-your-system

sudo apt update
sudo apt --only-upgrade install passbolt-ce-server
sudo apt upgrade

The --only-upgrade install step upgrades and fully configures passbolt while the database is still running normally. The apt upgrade afterwards restarts PostgreSQL without anything depending on it mid-flight.

Cheers
Gareth

thanks a lost

really great answer

bye