If you use Ubuntu in the cloud, specifically in AWS, you may see this warning message after SSHing into your server:
WARNING! Your environment specifies an invalid locale.
This can affect your user experience significantly, including the
ability to manage packages.
If you than try to install any new packages with apt-get or even restart/reload an existing service, you may get this error message:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_MESSAGES = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
The fix is pretty simple. Edit the /etc/environment file…