Something else to verify:
The /usr/bin/pg_config
binary is actually “managed” by alternatives
; see how it is on my system:
rockstable:~ # ls -lah /usr/bin/pg_config
lrwxrwxrwx 1 root root 27 Jan 26 07:11 /usr/bin/pg_config -> /etc/alternatives/pg_config
The latter is actually linking to the postgresql’s bin version:
rockstable:~ # ls -lah /etc/alternatives/pg_config
lrwxrwxrwx 1 root root 35 Jan 26 07:11 /etc/alternatives/pg_config -> /usr/lib/postgresql13/bin/pg_config
And to verify, we have:
rockstable:~ # /usr/bin/pg_config --version
PostgreSQL 13.11
rockstable:~ # /usr/lib/postgresql13/bin/pg_config --version
PostgreSQL 13.11
Maybe we need to re-set the alternatives on your system… First, let’s see if it is indeed listed:
rockstable:~ # update-alternatives --list postgresql
/usr/lib/postgresql13
… we should be able to move forward from there if needed.