I am trying to install Postgres 17, but when I try I get a conflict from DNF:
$ sudo dnf list installed postgresql
Updating and loading repositories:
Repositories loaded.
Installed packages
postgresql.x86_64 16.9-3.fc42 updates
Available packages
postgresql.i686 16.9-3.fc42 updates
$ sudo dnf install postgresql17-server
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
Problem: problem with installed package
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.i686 from fedora
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.i686 from fedora
- package postgresql-server-16.8-1.fc42.x86_64 from fedora conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.i686 from fedora
- conflicting requests
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.i686 from updates
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.i686 from updates
- package postgresql17-server-17.5-1.fc42.i686 from updates conflicts with postgresql-server-any provided by postgresql-server-16.8-1.fc42.x86_64 from fedora
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- package postgresql-server-16.8-1.fc42.x86_64 from fedora conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.x86_64 from updates
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.x86_64 from updates
- package postgresql17-server-17.5-1.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql-server-16.8-1.fc42.x86_64 from fedora
You can try to add to command line:
--allowerasing to allow removing of installed packages to resolve problems
--skip-broken to skip uninstallable packages
Initially I installed Postgres 16 in Fedora 39 from the Postgres repository, but at one point a Fedora update changed that to get it from Fedora’s repository. I didn’t mind at that time, so I removed the pdg repository.
But as I am relatively new to Fedora (or Linux) I don’t know how to resolve the above error.
Note that in order to migrate my Postgres 16 instance to 17 I need both binaries installed, so removing Postgres 16 isn’t really an option (or at least it would complicate things).
The typical way to upgrade is to install the new version, then run pg_upgrade (while the old version is still installed). Once the installation is finished, the old version can be removed.
It can be done using dump/restore and removing the old version before installing the new, but that takes substantially longer.
I believe the postgresql17-upgrade package provides a path similar to what you are describing.
Description : The postgresql-upgrade package contains the pg_upgrade utility and supporting
: files needed for upgrading a PostgreSQL database from the previous major
: version of PostgreSQL.
I imagine it’s from manually adding the PostgreSQL yourself in F39. It’s left behind stuff that’s now interfering with the installation/update process from Fedora’s own repositories. You can try adding the --allowerasing or --skip-broken arguments to the install command. It will show you what it’s going to install/update or remove before it does it. Then you can double check what it’s doing before it does it.
Personally, I would backup my data, purge PostgreSQL from my system and reinstall it through the Fedora repositories. As you say with dump/restore. How long would that action take? You say substantially longer, but what kind of time are we talking?
It’s not that long, the databases are only 30GB in total. But still I would really be interested in how such a situation could be resolved without uninstalling the old package. But it seems this is not possible.
--skip-broken doesn’t work, as it simply skips the Postgres 17 install. -allowerasing removes the Postgres 16 installation completely.
You can’t have both postgres versions installed at the same time, as they conflicts with each other. That is mainly because they will install files with the same name, and you can’t have two different files with the same name.
So if you want postgres 17 you need to remove postgres 16.
That surprises me. If they do, it’s something that Fedora imposes, not Postgres.
I have been doing that for a long time (just not on my private computer where I switched from Windows to Fedora a while ago).
It certainly works on Ubuntu, Oracle Linux and it used to work on CentOS. And this restriction breaks the recommended upgrade path using pg_upgrade.
The binaries are typically stored in version specific directories. The data directory (where the database content is located) is stored in version specific directories. The binaries in /usr/bin are typically symlinks to the “current” version (i.e. the most recent version installed). The are registered with different names as systemd services (e.g. postgresql-16.service and postgresql-17.service)
Thanks, unfortunately. Installing that package results in the same error:
~> sudo dnf install postgresql17-upgrade
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
Problem: package postgresql17-upgrade-17.2-1.fc42.i686 from fedora requires postgresql17-server(x86-32) = 17.2-1.fc42, but none of the providers can be installed
- conflicting requests
- postgresql17-server-17.2-1.fc42.i686 from fedora has inferior architecture
- package postgresql17-upgrade-17.2-1.fc42.x86_64 from fedora requires postgresql17-server(x86-64) = 17.2-1.fc42, but none of the providers can be installed
- problem with installed package
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- package postgresql-server-16.8-1.fc42.x86_64 from fedora conflicts with postgresql-server-any provided by postgresql17-server-17.2-1.fc42.x86_64 from fedora
- package postgresql17-upgrade-17.5-1.fc42.i686 from updates requires postgresql17-server(x86-32) = 17.5-1.fc42, but none of the providers can be installed
- postgresql17-server-17.5-1.fc42.i686 from updates has inferior architecture
- package postgresql17-upgrade-17.5-1.fc42.x86_64 from updates requires postgresql17-server(x86-64) = 17.5-1.fc42, but none of the providers can be installed
- installed package postgresql-server-16.9-3.fc42.x86_64 conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.x86_64 from updates
- package postgresql-server-16.9-3.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql17-server-17.5-1.fc42.x86_64 from updates
- package postgresql17-server-17.5-1.fc42.x86_64 from updates conflicts with postgresql-server-any provided by postgresql-server-16.8-1.fc42.x86_64 from fedora
You can try to add to command line:
--allowerasing to allow removing of installed packages to resolve problems
--skip-broken to skip uninstallable packages
I don’t understand why it lists two Postgres 16 packages (16.9. is the installed version)
Looks like completely removing is the only way forward
I tried that, but running the postgresql-update failed with some strange errors. I removed everything, installed postgres 17 (without the upgrade package) and used the good old pg_restore to restore my databases.
That sucks, I’d recommend uploading the logs and opening an issue for that if you have them, but you seems to have already finished the migration by hand.
I think my problem stemmed from the fact that I initially installed it from the Postgres repository.
There was also a systemd unit file that hardcoded the path to the data directory to include the version 16. Quite strange. Could be a left over from how the RPMs from Postgres setup the environment (one directory for each version).
I wonder if it’s possible to disable the Postgres packages from the Fedora repository and always use those from the Postgres repository. I am more used to the way they do the system integration (but then this is just my private computer to play around).