How to fix "Error: the locale requested by the environment is invalid" during postgresql cluster upgrade (pg_upgradecluster) How to fix "Error: the locale requested by the environment is invalid" during postgresql cluster upgrade (pg_upgradecluster) postgresql postgresql

How to fix "Error: the locale requested by the environment is invalid" during postgresql cluster upgrade (pg_upgradecluster)


had the same problem on an ubuntu 16.04 server. what helped in my case was to generate all the locales that appear in your listing of $ locale:

$ sudo locale-gen "en_US.UTF-8"$ sudo locale-gen "nl_NL.UTF-8"

good luck!


In my case, it was complaining about

Error: The locale requested by the environment is invalid:LANG: en_GBLANGUAGE: en_GB:en

So I unset LANG and unset LANGUAGE and it worked.


For me, I have followed many suggestions and still didn't work.The script mentioned

LC_TIME=en_UK but it's totally unrelated so I ignored it at first.Turns out this was the problem and doing "unset LC_TIME" was all I needed.

Posting here in case it happened to someone else.