Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create target cluster during upgrade 9.5 to 9.6

I am on ubuntu 16.04, and install postgres 9.5 on it

Then I to upgrade postgres 9.5 to 9.6, and I following postgresql offical download page to install 9.6:

enter image description here

then I run apt install postgresql-9.6, after install, I run following commands to upgrade

# stop the 9.6 
$ sudo pg_dropcluster 9.6 main --stop

# upgrade 9.5 to latest version
$ sudo pg_upgradecluster 9.5 main

sudo pg_upgradecluster 9.5 main
Stopping old cluster...
Notice: extra pg_ctl/postgres options given, bypassing systemctl for stop operation
Disabling connections to the old cluster during upgrade...
Restarting old cluster with restricted connections...
Redirecting start request to systemctl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Error: The locale requested by the environment is invalid.
Error: Could not create target cluster

Then I trying to using psql command to connection old cluster. but errors:

$ psql -U postgres -h localhost
psql: FATAL:  no pg_hba.conf entry for host "::1", user "postgres", database "postgres", SSL on
FATAL:  no pg_hba.conf entry for host "::1", user "postgres", database "postgres", SSL off

seems the pg_hba.conf is wrong, Then I check pg_hba.conf at /etc/postgresql/9.5/main/pg_hba.conf, but it seems fine:

local   all             postgres                                peer
like image 537
TangMonk Avatar asked Aug 07 '17 05:08

TangMonk


1 Answers

The only solution I could find to fix this is to run the following command:

export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8

Before proceeding with sudo pg_upgradecluster 9.5 main

like image 78
Luke Avatar answered Oct 01 '22 04:10

Luke