MAAS 3.6, which supports PostgreSQL 16, requires Ubuntu 24.04 LTS. Upgrade your system to this release before proceeding with the PostgreSQL upgrade.
You should upgrade the node Ubuntu distribution to 24.04 LTS before attempting to upgrade MAAS, so plan your maintenance window appropriately. Note that you might be required to upgrade PostgreSQL to version 16 before continuing with the MAAS upgrade.
Always back up your PostgreSQL data before performing a major upgrade.
sudo -u postgres pg_dumpall > backup.sqlFully update your current system:
sudo apt update
sudo apt upgradeCheck for sufficient free disk space
df -hBackup all important data and configurations - this is critical in case something goes wrong.
Reboot if needed - check if /run/reboot-required exists, which indicates a reboot is necessary.
Use the do-release-upgrade command:
sudo do-release-upgrade- It is significantly safer to upgrade a remote system using a hardware-based KVM over IP solution
- The upgrade is interactive - you'll need to monitor the process and respond to prompts about configuration file changes and package removals.
- Third-party repositories and PPAs will be automatically disabled during the upgrade. You'll need to re-enable them afterward if needed.
- Reboot is required - the system must be rebooted after the upgrade completes for changes to take effect.
On Ubuntu 24.04, install PostgreSQL 16 using:
sudo apt update
sudo apt install postgresql-16Stop MAAS to prevent database writes during the upgrade:
sudo snap stop maas # for snap installsUse the pg_upgradecluster tool to upgrade your cluster from 14 to 16.
Drop the newly created 16 cluster:
sudo pg_dropcluster 16 main --stopUpgrade de older cluster to the new version
sudo pg_upgradecluster 14 mainThis will migrate your data to the new PostgreSQL 16 cluster.
Ensure MAAS is configured to use the new PostgreSQL 16 cluster, which should be on the default port (5432).
Restart MAAS:
sudo snap start maas # for snap installsOnce you have verified that everything is working, remove the old cluster and packages:
sudo pg_dropcluster 14 main
sudo apt remove postgresql-14 postgresql-client-14 -y