2

When I run:

sudo pg_upgradecluster 9.3 main

I'm getting this error:

> perl: warning: Falling back to the standard locale ("C"). perl:
> warning: Setting locale failed. perl: warning: Please check that your
> locale settings:  LANGUAGE = (unset),     LC_ALL = (unset),   LC_CTYPE =
> "UTF-8",  LANG = "en_US.UTF-8"
>     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). Error: The locale requested by the
> environment is invalid. Error: Could not create target cluster

How could change the locale to perform this command?

S-Man
  • 22,521
  • 7
  • 40
  • 63
  • 1) This has nothing to do with Perl or PostgreSQL. If you run `locale`, you'll get equivalent warnings. 2) The problem didn't stop the program from running. Perl simply used a different local than requested to compensate. – ikegami May 17 '16 at 21:36
  • related issue: https://stackoverflow.com/questions/49089099/perl-fails-to-set-locale-even-though-it-is-installed – Khoi Ngo Apr 06 '22 at 10:00

2 Answers2

2

You need to run this:

aptitude install language-pack-es-base
locale-gen
​
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
​
echo LANGUAGE=en_US.UTF-8 > /etc/default/locale
echo LANG=en_US.UTF-8 >> /etc/default/locale
echo export LC_ALL=en_US.UTF-8 >> /etc/default/locale

This will solve your issue.

lsilva
  • 795
  • 5
  • 5
2

This happens when you SSH from your Mac laptop to a Linux server (including a virtual Linux server running on your laptop). SSH forwards the LANG and LC_* environment variables from the local shell to the remote shell, and some of the values used on the Mac are not valid on the Linux server.

The problem can be fixed in various ways, including installing the missing locales on the server. I recommend simply disabling the SSH environment forwarding, either on the server (remove AcceptEnv in /etc/ssh/sshd_config), or on the laptop (remove SendEnv in /etc/ssh/ssh_config), or both.

Read more in How to fix a locale setting warning from Perl?

  • I faced the same problem connecting from a Ubuntu 18.04 laptot to a Debian 9 server traying tu update from postgres 9.1 to 10. I fixed the problem removing AcceptEnv in /etc/ssh/sshd_config as you suggested. – Rodrigo Veron Sep 18 '19 at 15:55