After upgrading from Fedora 37 to Fedora 39, the postgres service fails to start with: Dec 16 17:53:52 example.org postgresql-check-db-dir[2044]: An old version of the database format was found. Dec 16 17:53:52 example.org postgresql-check-db-dir[2044]: Use 'postgresql-setup --upgrade' to upgrade to version '15 Unfortunately, the upgrade fails like this: # postgresql-setup --upgrade * Upgrading database. ERROR: pg_upgrade tool failed ERROR: Upgrade failed. * See /var/lib/pgsql/upgrade_postgresql.log for details. # cat /var/lib/pgsql/upgrade_postgresql.log Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checking database connection settings ok Checking for prepared transactions ok Checking for system-defined composite types in user tables ok Checking for reg* data types in user tables ok Checking for contrib/isn with bigint-passing mismatch ok Creating dump of global objects ok Creating dump of database schemas *failure* Consult the last few lines of "/var/lib/pgsql/data/pg_upgrade_output.d/20231216T184523.645/log/pg_upgrade_dump_16401.log" for the probable cause of the failure. Failure, exiting Unfortunately, the last redirection is wrong, i.e. (as strace shows), the upgrade command removes the pg_upgrade_output.d, before terminating, thus: # ls /var/lib/pgsql/data/pg_upgrade_output.d ls: cannot access '/var/lib/pgsql/data/pg_upgrade_output.d': No such file or directory However, the normal postgres logs contains further information: # cat /var/lib/pgsql/data/log/postgresql-Sat.log [..] 2023-12-16 18:08:14.254 CET [6085] LOG: starting PostgreSQL 14.9 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1), 64-bit 2023-12-16 18:08:14.257 CET [6085] LOG: listening on Unix socket "/var/lib/pgsql/.s.PGSQL.5432" 2023-12-16 18:08:14.276 CET [6087] LOG: database system was shut down at 2023-12-16 17:41:35 CET 2023-12-16 18:08:14.288 CET [6085] LOG: database system is ready to accept connections 2023-12-16 18:08:14.968 CET [6120] ERROR: could not access file "$libdir/postgis-3": No such file or directory 2023-12-16 18:08:14.968 CET [6120] STATEMENT: SELECT [..] In the past, the `ERROR: could not access file "$libdir/postgis-3": No such file or directory` was a sign for the postgis-upgrade package not being installed. In contrast to previous upgrade, the postgis-upgrade package isn't available anymore, on Fedora 39. Is there some alternative new way for upgrading postgis databases in Fedora? Reproducible: Always Steps to Reproduce: 1. Install Fedora 37 with postgres, postgis and postgis-upgrade packages 2. initialize database, enable postgis extension and create table that uses postgis features 3. upgrade to Fedora 39 4. postgresql-setup --upgrade 5. systemctl start postgresql Actual Results: the above errors Expected Results: the postfix database upgrade succeeds
You will need to update first to F38 and then to F39, or at least manually go through the F38 postgis package (which contains an -upgrade subpackage) [1]. F38 to F39 (and currently F39 to F40) does not provide any -upgrade package, since the postgis major version did not change between these releases. [1] https://koji.fedoraproject.org/koji/buildinfo?buildID=2207242
Sandro wrote: > You will need to update first to F38 and then to F39, or at least manually go through the F38 postgis package (which contains an -upgrade subpackage) I'm sorry, this is still a bug because it violates the general Fedora upgrade promise: > Upgrades to the very next release (e.g. 38 to 39) as well as upgrades skipping one release (e.g. 37 to 39) are both supported. https://docs.fedoraproject.org/en-US/quick-docs/upgrading-fedora-offline/#sect-how-many-releases-can-i-upgrade-across-at-once --- Anyhow, I worked around this issue and successfully migrated my postgis enabled database by installing the Fedora 37 postgres/postgis versions from the upstream repository and manually invoking pg_upgrade like this: cd /var/lib/pgsql tar cfvz /root/pg-14-data.tar.gz data mv data data.old cd /usr/bin/postgresql-setup --initdb dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-39-x86_64/pgdg-fedora-repo-latest.noarch.rpm dnf install postgresql14-server dnf install postgis32_14 sudo -u postgres pg_upgrade --old-datadir /var/lib/pgsql/data.old --new-datadir /var/lib/pgsql/data --old-bindir /usr/pgsql-14/bin --new-bindir /usr/bin systemctl start postgresql.service sudo -u postgres psql -f /var/lib/pgsql/update_extensions.sql sudo -u postgres reindexdb mydb sudo -u postgres /usr/bin/vacuumdb --all --analyze-in-stages rm -rf /var/lib/pgsql/data.old dnf remove postgresql14-server postgis32_14 dnf remove pgdg-fedora-repo-'*'
Problem here is that postgis-2.x does not build against postgres >= 15, so I'm afraid I wouldn't know how to offer a f37 -> f39 upgrade path short of patching postgis2 with PG15 support downstream which is non-trivial.
Hm, why postgis-2.x? AFAICS, Fedora 37 provided postgis version 3.2, didn't it? https://src.fedoraproject.org/rpms/postgis/blob/f37/f/postgis.spec#_8 And 3.2 seems to build against postgres 15, cf. e.g.: postgis32_15-3.2.5-2PGDG.f39.x86_64.rpm 20-Oct-2023 06:36 4063501 postgis32_15-3.2.6-1PGDG.f39.x86_64.rpm 21-Nov-2023 16:31 4067387 https://download.postgresql.org/pub/repos/yum/15/fedora/fedora-39-x86_64/
Sorry, I missed a point here, U was considering only the postgis-2.x -> 3.x upgrade, but indeed the issue here is upgrading postgis 3.x DBs between postgres versions. I've modified the postgis package to provide upgrade packages from the previous postgres version to the current one.
FEDORA-2023-9386ccb4bc has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-9386ccb4bc
FEDORA-2023-9386ccb4bc has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-9386ccb4bc` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-9386ccb4bc See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-7891a7002d has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-7891a7002d` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-7891a7002d See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-9386ccb4bc has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2023-7891a7002d has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report.