Linux – warning: setlocale: LC_ALL: cannot change locale on GCE instances

linux

We are not sure when this issue exactly started, but we recently found that when we log in GCE instance (debian-8-jessie-v20170110, in us-west1-b region), following warning message always appeared on console;

warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)

Do you guys have any idea why we suddenly started to get this warning message with GCE instances? We didn't change any locale related settings by ourselves.

After running sudo localedef -f UTF-8 -i ja_JP ja_JP.UTF-8, the warning message has disappeared, but it would be helpful if we could know why the issue was happening.

Best Answer

Your remote host doesn't support same locale configured on your local (see locale).

To ignore the warning, you can set LC_ALL to C before connecting, e.g.

LC_ALL=C ssh user@example.com

To install some specific language pack on the host, run:

sudo apt-get install language-pack-en language-pack-jp

To check all supported locale, run: locale -a.