Strange set locale behaviour when ssh from Windows PuTTY to Linux

Please,
can someone shed some light on this strange locales related warning annoying me since I installed my server half year ago. It’s a variant of “Cannot set LC_CTYPE to default locale”, which seems to be a pretty common issue, but mine has a strange twist, not matching any of the cases I found previously reported.
This warning is printed immediately after I log in with PuTTY on Windows to my openSUSE server.


-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF-8,LANG=en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF-8,LANG=en_US.UTF-8) 

Same happens when I use ssh command from Git Bash. When I log using VNC and open Konsole in KDE, Bash opens without any of these warnings.
What is unique to my case is the value it tries to set LC_CTYPE: en_GB.UTF-8,LANG=en_US.UTF-8. It looks like two concatenated strings. How this happened!?
This is original output on server side


 $ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_GB.UTF-8
LC_CTYPE=en_GB.UTF-8,LANG=en_US.UTF-8
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
...
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL= 

Note that:

  1. all variables are set except LC_ALL - is that normal?
  2. LC_CTYPE has the strange “concatenated” value
  3. All values has quotes around except LC_CTYPE
  4. warning is similar but complaining also about LC_ALL

I tried to fix it by editing ~/.profile, on the server side, by appending:


export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8 

Now, after re-logging, the locale seems to show reasonable values and no warnings from locale command:


$ locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
...
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8 

Should I worry about some values not having quotes around them?*

But the login warning is still there, still pulling en_GB.UTF8,LANG=en_US.UTF-8 from somewhere:


-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF8,LANG=en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF8,LANG=en_US.UTF-8) 

Linux server: “openSUSE Leap 15.0”
Windows client 1: PuTTY 0.70
Windows client 2: Git Bash 2.21.0 (MinTTY terminal)

Any ideas?

https://i.stack.imgur.com/QnEsW.png

https://i.stack.imgur.com/6ybQt.png

I also put my question here: https://serverfault.com/questions/956564/strange-set-locale-behaviour-when-ssh-from-windows-putty-to-linux

You assign to LC_CTYPE value “en_GB.UTF-8,LANG=en_US.UTF-8” which is wrong.

Any of the following might redefine:

erlangen:~ # grep -lr  LC_CTYPE /etc/
/etc/sudoers.rpmnew
/etc/sudoers
/etc/ssh/sshd_config
/etc/ssh/ssh_config
/etc/enscript.cfg
/etc/sudoers.YaST2.save
/etc/sysconfig/language
/etc/locale.conf
/etc/X11/xim
/etc/profile.d/sh.ssh
/etc/profile.d/lang.csh
/etc/profile.d/lang.sh
/etc/profile.d/csh.ssh
erlangen:~ # 

Some working settings:

karl@erlangen:~> locale
LANG=de_DE.UTF-8
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
karl@erlangen:~> 

Beware of /etc/ssh/ssh_config

Karl, thank you for the valuable help!


$ grep -r LC_CTYPE /etc/
..
/etc/locale.conf:LC_CTYPE=en_GB.UTF-8,LANG=en_US.UTF-8
..

On closer inspection, my /etc/locale.conf is just one line!


LC_CTYPE=en_GB.UTF-8,LANG=en_US.UTF-8

Is it normal? Why only LC_CTYPE is set? And to a very strange value? What should be there? Can I delete the file? Or rather set all LC_* values there?

You can use Yast2 > Sysconfig Editor > System > Environment > Language > RC_LANG: I have ‘de_DE.UTF-8’.

So yes, obviously, that was the cause issue. After I fixed my /etc/locale.conf all is tickety-boo. Thanks everyone for their help.

My current /etc/locale.conf:


LC_CTYPE=en_GB.UTF-8
LANG=en_GB.UTF-8

I am not sure what caused it, I suspect that system upgrade via zypper is the possible culprit, as I upgraded this box at least once.