0

Friday I did an upgrade from PostgreSQL 13 to 14 with pg_upgradecluster (on Debian Buster). This worked so today I wanted to upgrade another server (Linux Mint 20.3 Cinnamon). This time it does not work. Here is what I did:

root@farao:~# pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 13 main 5432 online postgres /srv/local/postgresql/13 /var/log/postgresql/postgresql-13-main.log 14 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log root@farao:~# pg_dropcluster --stop 14 main root@farao:~# pg_upgradecluster -V -v 13 main /srv/local/postgresql/data/14 Use of uninitialized value $newversion in string eq at /usr/bin/pg_upgradecluster line 398. Use of uninitialized value $_[0] in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 1049. Stopping old cluster... Restarting old cluster with restricted connections... Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation Use of uninitialized value $argv[10] in system at /usr/bin/pg_upgradecluster line 461. Error: invalid version '' Error: Could not create target cluster root@farao:~# pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 13 main 5432 online postgres /srv/local/postgresql/13 /var/log/postgresql/postgresql-13-main.log root@farao:~# ps -ef | grep postgres postgres 24351 1306 0 20:57 ? 00:00:00 /usr/lib/postgresql/13/bin/postgres -D /srv/local/postgresql/13 -c config_file=/etc/postgresql/13/main/postgresql.conf -c hba_file=/tmp/pg_hba.UabjBQ.conf postgres 24353 24351 0 20:57 ? 00:00:00 postgres: 13/main: checkpointer postgres 24354 24351 0 20:57 ? 00:00:00 postgres: 13/main: background writer postgres 24355 24351 0 20:57 ? 00:00:00 postgres: 13/main: walwriter postgres 24356 24351 0 20:57 ? 00:00:00 postgres: 13/main: autovacuum launcher postgres 24357 24351 0 20:57 ? 00:00:00 postgres: 13/main: stats collector postgres 24358 24351 0 20:57 ? 00:00:00 postgres: 13/main: logical replication launcher root 24488 18929 0 20:58 pts/0 00:00:00 grep --color=auto postgres root@farao:~# cat /tmp/pg_hba.UabjBQ.conf local all postgres ident root@farao:~# pg_upgradecluster -V -v 13 main /srv/local/postgresql/data/14 Use of uninitialized value $newversion in string eq at /usr/bin/pg_upgradecluster line 398. Use of uninitialized value $_[0] in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 1049. Stopping old cluster... Restarting old cluster with restricted connections... Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation Use of uninitialized value $argv[10] in system at /usr/bin/pg_upgradecluster line 461. Error: invalid version '' Error: Could not create target cluster root@farao:~# pg_upgradecluster Usage: /usr/bin/pg_upgradecluster [OPTIONS] <old version> <cluster name> [<new data directory>] root@farao:~# 

Without the -V parameter, the result is the same. What did I do wrong? Do I need to install a PERL module?

remark I just remembered that I only installed postgresql-13 and used the database and configuration that was still present. Does PostgreSQL store somewhere information about the clusters that it created with initdb? Not logical because pg_lsclusters can find it.

1
  • Does simple command pg_upgradecluster 13 main work ? Can you try same command without dropping 14 main Commented Jan 19, 2022 at 14:40

1 Answer 1

1
+250

From what I read in the man page of pg_upgradecluster, there might be a typo in your command.

Here is the synopsis from the man page:

pg_upgradecluster [-v newversion] oldversion name [newdatadir] 

Either keep -v and explicitly add the new version number :

pg_upgradecluster -V -v 14 13 main /srv/local/postgresql/data/14 

or remove -v altogether (will default to the latest available version) :

pg_upgradecluster -V 13 main /srv/local/postgresql/data/14 
1
  • Was a typo :-( The command pg_upgradecluster -v 14 13 main /srv/local/postgresql/data/14 worked like a charm. You deserve the bounty. Commented Jan 19, 2022 at 16:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.