Skip to content

Fixing locale message in Ubuntu when logging in or SCPing

I’ve encountered this error occasionally when loggin in:

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

This breaks things like scp or bzr via sftp. To fix it, I followed this advice:

cd /var/lib/locales/supported.d
cat /usr/share/i18n/SUPPORTED|grep -i nl > nl
dpkg-reconfigure locales

It’s not really pretty though; it shouldn’t give an error at all when a locale is missing. I mean, this way, I have to generate every possible locale to support logins from all over the world…

    5 Comments ( Add comment / trackback )

    1. (permalink)
      Comment by IRaceMyCase
      On February 24, 2012 at 10:30

      Hey halvegare,

      You could also run the following command:

      locale-gen nl_NL.UTF-8

      And you should be on your way.

    2. (permalink)
      Comment by halfgaar
      On March 2, 2012 at 21:23

      Thanks for the tip; I’ll try it next time I see this error.

    3. (permalink)
      Comment by halfgaar
      On December 7, 2013 at 11:09

      I found here that putting the following in /etc/environment perhaps also works:


      That would make logging in from every locale in the world possible, I guess.

    4. (permalink)
      Comment by Noah Spurrier
      On June 2, 2014 at 07:46

      You should only set “LANG=en_US.UTF-8″. Leave out the “LC_ALL=en_US.UTF-8″. The original error can be confusing because LC_ALL is used in two different contexts. The LC_ALL environment variable you are setting in /etc/environment does not refer to the same thing as the LC_ALL in the error message. Also, setting both LC_ALL and LANG would be redundant as the LC_ALL environment variable overrides LANG anyway. Almost always use LANG where people tell you to use LC_ALL. Only use LC_ALL in special cases where there is no other option. Using it at a global level will hide other problems and introduce new ones.

    5. (permalink)
      Comment by Claudia
      On March 31, 2015 at 07:04

      At the end of the experiment, check which team has the maximum number of accurate drawings and conclude
      your hypothesis. A new free online zoo gazme from Bigpoint, Zoomumba also
      offers players the challenge to run their own zoo by building
      habitats, buying animals, and then breeding
      and caring for them while appeasing visitors. When you use
      the laser, be sure not to shine it in their eyes, because that
      could actually blind them (but I’m sure you knew
      that already ).

    Post a comment


    Your email is never published nor shared.

    Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>