15

When I log into my server (Debian 7) through PuTTY, I get greeted by a message saying:

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

Then, when I try to run almost any command I get this:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_GB:en",
        LC_ALL = "en_GB.UTF-8",
        LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

I have looked all over the web for help. My /etc/environment file has 'LC_ALL="en_GB.UTF-8"' within it.

Typing;

locale -a

prints the following:

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_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

This is the result of locale-gen:

root@vps94194:/# locale-gen
-bash: locale-gen: command not found

The same goes for the update-locale command.

I cannot reinstall the locale through aptitude as the error blocks it. I can't use dpkg to reconfigure for the same reason.

I really don't know how to fix this. Nothing so far has made any difference.

3 Answers 3

13

Use:

export LC_ALL=C

and install what is needed via aptitude (locales package or something equivalent).

If you still get some error due to previous failure, first run:

apt-get install -f
4
  • This gets rid of the perl errors but aptitude is erroring: dpkg: error processing package initscripts (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: initscripts Sep 23, 2014 at 20:45
  • @Briggy I've completed my answer: apt-get install -f should fix problems. Otherwise your system is in a seriously broken state.
    – vinc17
    Sep 23, 2014 at 20:50
  • Thanks, that worked, I had to remove a symbolic link, but after that everything worked fine. You're a lifesaver :) Sep 23, 2014 at 20:52
  • @Briggy See Here after exporting LC_ALL
    – eyoung100
    Sep 23, 2014 at 20:53
3

I was using German VPS and couldn't change locale because there was no English language pack installed.

After installing I could finally change locale

aptitude install language-pack-en
2

Consider adding the following rule to your ~/.ssh/config:

Host *
  SetEnv LC_ALL=C

Assuming your SSH server got the following line in /etc/ssh/sshd_config:

AcceptEnv LANG LC_*

Check also: man ssh_config and man sshd_config.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .