1
# dnf list installed | grep postgresql
VRTSnbpostgresqlagent.x86_64                  9.1.0.0-1620848511                                  @System                
postgresql.x86_64                             10.17-2.module+el8.5.0+11838+8dca950a               @rhel8-appstream       
postgresql-server.x86_64                      10.17-2.module+el8.5.0+11838+8dca950a               @rhel8-appstream       
postgresql10.x86_64                           10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-contrib.x86_64                   10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-libs.x86_64                      10.22-1PGDG.rhel8                                   @rhel8-pgdg10          
postgresql10-server.x86_64                    10.22-1PGDG.rhel8                                   @rhel8-pgdg10
# dnf list installed | grep postgis
postgis31_10.x86_64                           3.1.7-1.rhel8                                       @rhel8-pgdg10          
postgis31_10-client.x86_64                    3.1.7-1.rhel8                                       @rhel8-pgdg10          
postgis31_10-devel.x86_64                     3.1.7-1.rhel8                                       @@commandline          
postgis31_10-utils.x86_64                     3.1.7-1.rhel8                                       @@commandline

(My colleague manually downloaded those latter two packages from... somewhere)

When we try to CREATE EXTENSION postgis; we get the following error

ERROR:  could not access file "$libdir/postgis-3": No such file or directory

Our PostgreSQL installation location in /usr/pgsql-10/ and inside /usr/pgsql-10/lib are the .so files for the extension (e.g. postgis-3.so). Inside /usr/pgsql-10/share/extension are postgis*.control files which contain:

# postgis extension
comment = 'PostGIS geometry and geography spatial types and functions'
default_version = '3.1.7'
module_pathname = '$libdir/postgis-3'
relocatable = false

When I tried adding a libdir=/usr/pgsql-10/lib line to the file the error was ERROR: unrecognized parameter "libdir" in file "/usr/share/pgsql/extension/postgis.control" but when we replaced the path in module_pathname to include /usr/pgsql-10/lib we just got the same error as before ERROR: could not access file "$libdir/postgis-3": No such file or directory. Also tried installing other non-PostGIS extensions and got similar could not access "$libdir/extension" errors.

This server is managed by our IT who helped install some of the postgis packages so I'm not sure if there's somehow a package universe mismatch here.

Some further context after reading this answer, the PostgreSQL data directory is mounted at a different location for space reasons (/pgdata), so maybe something got missed in that configuration change?

2 Answers 2

1

I had a similar issue and it turned out that I had two different versions of postgresql installed at the same time. From what you are showing, I think you should remove postgresql.x86_64 and postgresql-server.x86_64. You can delete them with dnf remove.

Note that you might need to re-install the correct packages with dnf reinstall after removing the incompatible packages

0

The packages whose version contains the PGDG substring come from the upstream postgres rpm repository:

https://www.postgresql.org/download/linux/redhat/

It looks like the parallel installed postgres server that is provided by RHEL's own repository, as a module, is interfering with the upstream version.

Or, you are accessing the rhel postgres server and/or commands, by accident. That would make sense because a postgis package is only installed for the upstream version.

The postgres upstream rpm repository instructions even include:

sudo dnf -qy module disable postgresql

Of course, if you want to rely on rhel support for postgres you should stick to the rhel provided postgres packages and use those instead of the upstream ones (i.e. migrate your database data and uninstall the upstream packages).

However, I'm not sure whether rhel even packages postgis.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.