Closed phillxnet closed 1 year ago
Our expectation re postgresql packages is:
buildvm:~ # zypper search --installed-only | grep postgresql
i | openSUSE-SLE-15.4-2022-1463 | Recommended update for postgresql13
i | openSUSE-SLE-15.4-2022-1895 | Security update for postgresql13
i | openSUSE-SLE-15.4-2022-1908 | Security update for postgresql14
i | openSUSE-SLE-15.4-2022-2706 | Recommended update for postgresql
i | openSUSE-SLE-15.4-2022-2987 | Security update for postgresql13
i | openSUSE-SLE-15.4-2022-2989 | Security update for postgresql14
i | openSUSE-SLE-15.4-2022-4447 | Recommended update for postgresql13
i | openSUSE-SLE-15.4-2022-4645 | Security update for postgresql14, postgresql15
i | openSUSE-SLE-15.4-2023-83 | Recommended update for postgresql
i | openSUSE-SLE-15.4-2023-569 | Security update for postgresql15
i | openSUSE-SLE-15.4-2023-583 | Security update for postgresql13
i | openSUSE-SLE-15.4-2023-2207 | Security update for postgresql15
i | openSUSE-SLE-15.4-2023-2219 | Security update for postgresql13
i | postgresql | Basic Clients and Utilities for PostgreSQL
i | postgresql-devel | PostgreSQL development header files and libraries
i | postgresql-server | The Programs Needed to Create and Run a PostgreSQL Server
i | postgresql-server-devel | PostgreSQL server development header files and utilities
i | postgresql13 | Basic Clients and Utilities for PostgreSQL
i | postgresql13-devel | PostgreSQL client development header files and libraries
i | postgresql13-server | The Programs Needed to Create and Run a PostgreSQL Server
i | postgresql13-server-devel | PostgreSQL server development header files and utilities
If we emulate an OS update via a dup where the 'default' Postgresql is now 14:
buildvm:~ # zypper in --no-recommends postgresql14 postgresql14-server
we have our prior (and default) 'auto' alternatives setting obscuring our previously available pg_config:
buildvm:~ # update-alternatives --display postgresql
postgresql - auto mode
link best version is /usr/lib/postgresql14
link currently points to /usr/lib/postgresql14
link postgresql is /usr/lib/postgresql
slave clusterdb is /usr/bin/clusterdb
slave createdb is /usr/bin/createdb
slave createuser is /usr/bin/createuser
slave dropdb is /usr/bin/dropdb
slave dropuser is /usr/bin/dropuser
slave ecpg is /usr/bin/ecpg
slave initdb is /usr/bin/initdb
slave pg_basebackup is /usr/bin/pg_basebackup
slave pg_checksums is /usr/bin/pg_checksums
slave pg_config is /usr/bin/pg_config
slave pg_controldata is /usr/bin/pg_controldata
slave pg_ctl is /usr/bin/pg_ctl
slave pg_dump is /usr/bin/pg_dump
slave pg_dumpall is /usr/bin/pg_dumpall
slave pg_isready is /usr/bin/pg_isready
slave pg_receivewal is /usr/bin/pg_receivewal
slave pg_recvlogical is /usr/bin/pg_recvlogical
slave pg_resetwal is /usr/bin/pg_resetwal
slave pg_restore is /usr/bin/pg_restore
slave pg_rewind is /usr/bin/pg_rewind
slave pg_verifybackup is /usr/bin/pg_verifybackup
slave pg_waldump is /usr/bin/pg_waldump
slave postgres is /usr/bin/postgres
slave postmaster is /usr/bin/postmaster
slave psql is /usr/bin/psql
slave reindexdb is /usr/bin/reindexdb
slave vacuumdb is /usr/bin/vacuumdb
/usr/lib/postgresql13 - priority 130
slave clusterdb: /usr/lib/postgresql13/bin/clusterdb
slave createdb: /usr/lib/postgresql13/bin/createdb
slave createuser: /usr/lib/postgresql13/bin/createuser
slave dropdb: /usr/lib/postgresql13/bin/dropdb
slave dropuser: /usr/lib/postgresql13/bin/dropuser
slave ecpg: /usr/lib/postgresql13/bin/ecpg
slave initdb: /usr/lib/postgresql13/bin/initdb
slave pg_basebackup: /usr/lib/postgresql13/bin/pg_basebackup
slave pg_checksums: /usr/lib/postgresql13/bin/pg_checksums
slave pg_config: /usr/lib/postgresql13/bin/pg_config
slave pg_controldata: /usr/lib/postgresql13/bin/pg_controldata
slave pg_ctl: /usr/lib/postgresql13/bin/pg_ctl
slave pg_dump: /usr/lib/postgresql13/bin/pg_dump
slave pg_dumpall: /usr/lib/postgresql13/bin/pg_dumpall
slave pg_isready: /usr/lib/postgresql13/bin/pg_isready
slave pg_receivewal: /usr/lib/postgresql13/bin/pg_receivewal
slave pg_recvlogical: /usr/lib/postgresql13/bin/pg_recvlogical
slave pg_resetwal: /usr/lib/postgresql13/bin/pg_resetwal
slave pg_restore: /usr/lib/postgresql13/bin/pg_restore
slave pg_rewind: /usr/lib/postgresql13/bin/pg_rewind
slave pg_verifybackup: /usr/lib/postgresql13/bin/pg_verifybackup
slave pg_waldump: /usr/lib/postgresql13/bin/pg_waldump
slave postgres: /usr/lib/postgresql13/bin/postgres
slave postmaster: /usr/lib/postgresql13/bin/postmaster
slave psql: /usr/lib/postgresql13/bin/psql
slave reindexdb: /usr/lib/postgresql13/bin/reindexdb
slave vacuumdb: /usr/lib/postgresql13/bin/vacuumdb
/usr/lib/postgresql14 - priority 140
slave clusterdb: /usr/lib/postgresql14/bin/clusterdb
slave createdb: /usr/lib/postgresql14/bin/createdb
slave createuser: /usr/lib/postgresql14/bin/createuser
slave dropdb: /usr/lib/postgresql14/bin/dropdb
slave dropuser: /usr/lib/postgresql14/bin/dropuser
slave initdb: /usr/lib/postgresql14/bin/initdb
slave pg_basebackup: /usr/lib/postgresql14/bin/pg_basebackup
slave pg_checksums: /usr/lib/postgresql14/bin/pg_checksums
slave pg_controldata: /usr/lib/postgresql14/bin/pg_controldata
slave pg_ctl: /usr/lib/postgresql14/bin/pg_ctl
slave pg_dump: /usr/lib/postgresql14/bin/pg_dump
slave pg_dumpall: /usr/lib/postgresql14/bin/pg_dumpall
slave pg_isready: /usr/lib/postgresql14/bin/pg_isready
slave pg_receivewal: /usr/lib/postgresql14/bin/pg_receivewal
slave pg_recvlogical: /usr/lib/postgresql14/bin/pg_recvlogical
slave pg_resetwal: /usr/lib/postgresql14/bin/pg_resetwal
slave pg_restore: /usr/lib/postgresql14/bin/pg_restore
slave pg_rewind: /usr/lib/postgresql14/bin/pg_rewind
slave pg_verifybackup: /usr/lib/postgresql14/bin/pg_verifybackup
slave pg_waldump: /usr/lib/postgresql14/bin/pg_waldump
slave postgres: /usr/lib/postgresql14/bin/postgres
slave postmaster: /usr/lib/postgresql14/bin/postmaster
slave psql: /usr/lib/postgresql14/bin/psql
slave reindexdb: /usr/lib/postgresql14/bin/reindexdb
slave vacuumdb: /usr/lib/postgresql14/bin/vacuumdb
buildvm:~ # pg_config --version
-bash: pg_config: command not found
As we have on postgresql14-server-devel installed: however we require the use of our existing installed (via rpm dependencies '13' version to be used. Hence this proposed patch.
buildvm:~ # zypper in rockstor-5.0.1-38
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following NEW package is going to be installed:
rockstor
1 new package to install.
Overall download size: 2.3 MiB. Already cached: 0 B. After the operation, additional 9.6 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving: rockstor-5.0.1-38.x86_64 (Buildbot-Testing) (1/1), 2.3 MiB
Retrieving: rockstor-5.0.1-38.x86_64.rpm ....................................................................................................[done]
Checking for file conflicts: ................................................................................................................[done]
update-alternatives: using /usr/lib/postgresql13 to provide /usr/lib/postgresql (postgresql) in manual mode
Created symlink /etc/systemd/system/multi-user.target.wants/rockstor-bootstrap.service -> /usr/lib/systemd/system/rockstor-bootstrap.service.
(1/1) Installing: rockstor-5.0.1-38.x86_64 ..................................................................................................[done]
Retrieving Poetry metadata
The latest version (1.1.15) is already installed.
...
With the resulting system, previously without 'in-path' pg_config due to alternatives auto obscuring that utility due to our incomplete (and incompatible) postgresql14 package set (no server-devel), now being adjusted, via %post scriptlet, to present as we require:
buildvm:~ # pg_config --version
PostgreSQL 13.11
buildvm:~ # update-alternatives --config postgresql
There are 2 choices for the alternative postgresql (providing /usr/lib/postgresql).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/postgresql14 140 auto mode
* 1 /usr/lib/postgresql13 130 manual mode
2 /usr/lib/postgresql14 140 manual mode
Press <enter> to keep the current choice[*], or type selection number:
Test command line update (using PR rpm) on a previously failed venv build (%posttrans) caused by a rockstor package version <=5.0.1-0 install on a system with obscured pg_config. This way we know the behaviour regarding our recent measures re venv wipe and this proposed alternatives assertion when updating a previously failed install.
Test of package (built post-patch) recovery from prior failed install:
zypper remove rockstor
rm -rf /opt/rockstor
# select auto in the following on our prior reproducer system
alternatives --config postgresql
# confirm obscured pg_config (as no postgresql14-server-devel) in 14 set.
buildvm:~ # which pg_config
which: no pg_config in (/sbin:/usr/sbin:/usr/local/sbin:/root/.local/bin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin)
We now install a <= 5.0.0-0 but Poetry based rockstor instance, to replicate the reported instance (see linked issue) of a 'dead' Rockstor update due to failed %posttrans build.sh venv instantiation due to missing (obscured) pg_config.
zypper in rockstor-5.0.0-0
tail -n 34 /opt/rockstor/poetry-install.txt | head -n 7
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
So we have a fresh install, in this case, with a failed venv build. On a system which has, as an update, our PR build rpm 5.0.1-38
zypper in rockstor
tail -n 7 /opt/rockstor/poetry-install.txt
• Installing psycopg2 (2.8.6)
• Installing python-socketio (1.6.0)
• Installing pyzmq (19.0.2)
• Installing supervisor (4.2.4)
• Installing urlobject (2.1.1)
Installing the current project: rockstor (5.0.1)
So we have a restored venv. And post reboot we have a restored Web-UI.
Enforce, via manual alternatives configuration, our target postgresql version.
Fixes #34