I'm upgrading from Postgres 15 to 16 on Arch using the default documentation. When I reach the pg_upgrade section:
pg_upgrade -b /opt/pgsql-15/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
Then I get a "failure" exit. When I check the pg_upgrade_output.d log file I found an error related to PostGIS path:
command: "/usr/bin/pg_dump" --host /var/lib/postgres --port 50432 --username postgres --schema-only --quote-all-identifiers --binary-upgrade --format=custom --file="/var/lib/postgres/data/pg_upgrade_output.d/20231207T105131.842/dump/pg_upgrade_dump_16385.custom" 'dbname=linuxbox_db' >> "/var/lib/postgres/data/pg_upgrade_output.d/20231207T105131.842/log/pg_upgrade_dump_16385.log" 2>&1
pg_dump: error: query failed: ERROR: could not access file "$libdir/postgis-3": No such file or directory
Is it something on my system or a bug in the pg_upgrade code?
The error was because I needed to rebuild the postgis library after installing v16 and before running the pg_upgrade.
If someone else ends up having trouble upgrading on Arch, here is a summary of the steps I followed:
check the modifications to postgis-old-upgrade for the latest postgresql version! (check AUR page)
Update all the db to current collation version. Get into psql from postgresql account and it will tell you the command to use or run the script https://gist.github.com/AlfredoRamos/63def9c77081a6dba7db38d3b0669cef
Stop postgresql from syscntl
sudo systemctl stop postgresql.service
sudo mv /var/lib/postgres/data /var/lib/postgres/olddata
sudo mkdir /var/lib/postgres/data /var/lib/postgres/tmp
sudo chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp
sudo -i -u postgres
[postgres]$ cd /var/lib/postgres/tmp
[postgres]$ initdb -D /var/lib/postgres/data --locale=C.UTF-8 --encoding=UTF8
sudo systemctl start postgresql.service
pgxn install h3
sudo systemctl stop postgresql.service
[postgres]$ pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data