Jens Segers on

Ubuntu locale warning

While working on my personal Ubuntu server, I often run into the following locale warnings.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
    LC_ALL = (unset),
    LC_CTYPE = "nl_BE.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_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

First you should check if there is anything wrong with your locales. Execute the following commands:

> locale-gen en_US.UTF-8
> sudo dpkg-reconfigure locales

Funny enough, the warning messages also appear when executing that last command. If we inspect the warning messages we see that LC_ALL is not set. You can set this value by adding it to the /etc/default/locale file:


There you go, relog and the warnings should be gone.


Tweet about this blog post and you will appear below!