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…

3 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.

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=""> <strike> <strong>