1

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 Linux 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?

PuTTY just after logging in showing LC_CTYPE: cannot change locale warning
ssh in Git Bash just after logging in showing LC_CTYPE: cannot change locale warning

  • What happens if you unset LC_ALL? – fpmurphy Mar 4 at 0:22
  • LC_ALL was unset at the beginning, to the best of my understanding. Or did you mean explicitly unset it with a specific command? Would it make difference? – Espinosa Mar 7 at 23:09
  • I stopped setting LC_ALL in my ~/.profile, it looks like its normal that it's not set. I set only LC_CTYPE and LANG ..and still the warning is there – Espinosa Mar 11 at 2:15
0

(I can't comment.)

Is /etc/ssh/sshd_config in Linux the following line?

AcceptEnv LANG LC_*
  • Yes, I have AcceptEnv LANG LANG LC_CTYPE in my /etc/ssh/sshd_config. And I also have SendEnv LANG LC_CTYPE in my /etc/ssh/ssh_config if that is of any importance. – Espinosa Mar 11 at 2:10
0

Solved, end of mystery. Problem was in file /etc/locale.conf. It had just one strange line:

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

When I changed it to:

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

..warning disappeared!

Looks like openSUSE bug; most likely some system upgrade screwed this file, turned line end to a comma. I got a good help on this openSUSE forum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.