Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a fresh ubuntu 12.04 installation. When i connect to my remote server i got errors like this:

~$ ssh sudo aptitude upgrade
Traceback (most recent call last):
  File "/usr/bin/apt-listchanges", line 33, in <module>
    from ALChacks import *
  File "/usr/share/apt-listchanges/", line 32, in <module>
    sys.stderr.write(_("Can't set locale; make sure $LC_* and $LANG are correct!\n"))
NameError: name '_' is not defined
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "de_DE.UTF-8",
    LC_MONETARY = "de_DE.UTF-8",
    LC_ADDRESS = "de_DE.UTF-8",
    LC_TELEPHONE = "de_DE.UTF-8",
    LC_NAME = "de_DE.UTF-8",
    LC_NUMERIC = "de_DE.UTF-8",
    LC_PAPER = "de_DE.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_ALL to default locale: No such file or directory
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

I don't have this problem when i connect from an older ubuntu installation. This is output from my ubuntu 12.04 installation, LANG and LANGUAGE are set

$ locale

Does anybody know what has changed in ubuntu to get this error message on remote servers?

share|improve this question
possible duplicate of How do I fix my locale issue? – dn-ʞɔɐq ɹW Feb 23 '15 at 12:03
up vote 106 down vote accepted

That's because your locale in your local machine is set to German, which SSH forwards to and tries to use on the server, but your server does not have it installed.

You've got several options:

  • Generate the locale. Generate the German locale on the server with sudo locale-gen de.

  • Stop forwarding locale from the client. Do not forward the locale environment variable from your local machine to the server. You can comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.

  • Stop accepting locale on the server. Do not accept the locale environment variable from your local machine to the server. You can comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.

  • Set the server locale to English. Explicitly set the locale to English on the server. As an example, you can add the following lines to your remote ~/.bashrc or ~/.profile files:

    export LANGUAGE="en"
    export LANG="C"
    export LC_MESSAGES="C"

If you don't have root access to the server, the Stop forwarding locale from the client option might be the best (and only) way to go.

share|improve this answer
Hah! I totally missed the fact that he listed the client's locale settings! Great job... – izx May 31 '12 at 7:29
Great answer! Thx – Janning May 31 '12 at 8:21
I decided to "Stop forwarding locale from the client". Works fine. For future reference: you can't override SendEnv settings from /etc/ssh/ssh_config in your local ~/.ssh/config. See – Janning Jun 3 '12 at 23:50
Combined with, SSH's sending of locales can cause real problems (and caused for me actually), see ... – Halil Özgür Nov 14 '13 at 17:00
Great! Stop forwarding locale from the client worked! – Luis Lobo Borobia Nov 25 '14 at 17:51

This can happen sometimes on fresh minimal/alternate installs or in other situations. The fix is pretty simple. Try these, in the following order, testing after each to see if the situation is fixed:

1. Reconfigure locales

  • sudo dpkg-reconfigure locales
    • if that doesn't work,

2. Reinstall locale language-pack

  • sudo apt-get --reinstall install language-pack-de
    • if that doesn't work,

3. Manually force locale settings (persistent)

  • sudo update-locale LC_ALL=de_DE.UTF-8 LANG=de_DE.UTF-8
share|improve this answer
I have a JVM problem and I'm trying to set the system locale in 12.04 also. Only problem is I can't seem to set the LC_ALL no matter what I try, locales still shows it as empty. – Dark Star1 Dec 11 '12 at 1:09

Comment the line SendEnv LANG LC_* in /etc/ssh/ssh_config, so it should looks like:

#SendEnv LANG LC_*
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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