perl: warning: Setting locale failed

6

There seems to be an error with the local settings of Perl and / or the system, but the details obtained do not clarify what is is passing:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "pt_PT.UTF-8",
    LC_ADDRESS = "pt_PT.UTF-8",
    LC_MONETARY = "pt_PT.UTF-8",
    LC_NUMERIC = "pt_PT.UTF-8",
    LC_TELEPHONE = "pt_PT.UTF-8",
    LC_IDENTIFICATION = "pt_PT.UTF-8",
    LC_MEASUREMENT = "pt_PT.UTF-8",
    LC_TIME = "pt_PT.UTF-8",
    LC_NAME = "pt_PT.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

This error is visible, for example, when you use the command adduser :

# sudo adduser zuul

Question

How to evaluate and resolve any problem with local settings?

x86_64
Ubuntu 12.04.4 LTS
Perl 5, version 14, subversion 2 (v5.14.2)

    
asked by anonymous 15.05.2015 / 11:54

2 answers

5

You can use the locale-gen command to recompile the files definition of locality :

~$ sudo locale-gen pt_PT.UTF-8
[sudo] password for [usuário]: 
Generating locales...
  pt_PT.UTF-8... up-to-date
Generation complete.
~$

This will require reconfiguring the locality using command dpkg-reconfigure :

~$ sudo dpkg-reconfigure locales
[sudo] password for [usuário]: 
Generating locales...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  ...
  pt_BR.UTF-8... done
  pt_PT.UTF-8... up-to-date
Generation complete.
~$

If you want to do this from manual way , modify the file etc/default/locale , or for a specific user, the .pam_environment file located in the HOME vice folder of the user.

~$ nano /etc/default/locale    # todo sistema
~$ nano $HOME/.pam_environment # usuário em específico

In older versions you can use update-locale command :

~$ sudo update-locale LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8
    
18.05.2015 / 01:00
0

It is probably missing glibc language packs. Although the variables are defined, if the binaries do not exist, it does not work.

Verify that language packs are available. In Fedora are the following:

  • langpacks-pt
  • glibc-langpack-pt

Once installed, excute:

$locale

LANG=pt_BR.UTF-8 LC_CTYPE="pt_BR.UTF-8" LC_NUMERIC="pt_BR.UTF-8" LC_TIME="pt_BR.UTF-8" LC_COLLATE="pt_BR.UTF-8" LC_MONETARY="pt_BR.UTF-8" LC_MESSAGES="pt_BR.UTF-8" LC_PAPER="pt_BR.UTF-8" LC_NAME="pt_BR.UTF-8" LC_ADDRESS="pt_BR.UTF-8" LC_TELEPHONE="pt_BR.UTF-8" LC_MEASUREMENT="pt_BR.UTF-8" LC_IDENTIFICATION="pt_BR.UTF-8" LC_ALL=

If your output is similar to this okay. If not, run:

$localectl set-locale LANG=pt_BR.utf8

This should solve your problems.

    
21.11.2018 / 15:57