Loading...

Website Blog

On november 16, 2004, I created the first blog to post some news and comments among my classmates and me. Now, I want to share some small view points with all the people around the world.

Perl: Warning: Falling back to the standard locale ("C")

Troubleshoot

This is an unbearable message that most people sees at upgrading or installing a package and maybe you got one of the following errors:


Can't set locale; make sure $LC_* and $LANG are correct!                                                                                
Reading changelogs... Done                                                                                                              
perl: warning: Setting locale failed.                                                                                                   
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "en_US.UTF-8",
        LC_MONETARY = "en_US.UTF-8",
        LC_ADDRESS = "en_US.UTF-8",
        LC_TELEPHONE = "en_US.UTF-8",
        LC_NAME = "en_US.UTF-8",
        LC_MEASUREMENT = "en_US.UTF-8",
        LC_IDENTIFICATION = "en_US.UTF-8",
        LC_NUMERIC = "en_US.UTF-8",
        LC_PAPER = "en_US.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

or


can't set the locale; make sure $LC_* and $LANG are correct.

or


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

This problem on your system is very harmless, so do not worry. A lot of people tried to solve this running the command sudo dpkg-reconfigure locales but it is not always the solution.

This is a very common error due to a wrong localization value, and it is commonly presented in some Debian and Ubuntu environments. If you got one of these errors, don't worry because it is very easy to resolve.

As first stage, you must install the language pack you want to use, e.g:


sudo apt-get install language-pack-en

Once you have already installed the language pack, take a look at /etc/environment and /etc/default/locale files, then check if these values are already set. If the same have not been set yet, you just should add them.


LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

Finally generate your custom locale, you should run:


sudo locale-gen

Keep on the process, then you will have something like this:


Generating locales...
en_US.UTF-8... done
Generation complete.

Note:

If after having done the previous steps the boring and unbearable error persists, the best bit is to enable all the values through the locale generator according to your language pack, e.g: sudo locale-gen en_US.UTF-8.

Finally you may need to configure the local packages again in order to generate your new configuration, e.g: sudo dpkg-reconfigure locales.

You're done!

Your locale configuration is already fixed, and it was pretty simple to solve.

Comments

Brian's profile picture.

Amazing! It definitely worked good, some other posts mention those values should be added as global variables (exported through the linux shell), but it was not necessary, I just installed the language pack I needed and then I added the values into those files...done and dusted!

April 15, 2015