WARNING! Your environment specifies an invalid locale. This can affect your user experience significantly, including the ability to manage packages

October 18, 2015 8.9k views
Server Optimization Logging Monitoring

Hi everyone, just finished trying a new instance of ubuntu, first time logging in and got the following notification :

Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
_____________________________________________________________________
WARNING! Your environment specifies an invalid locale.
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:

   sudo apt-get install language-pack-UTF-8
     or
   sudo locale-gen UTF-8

To see all available language packs, run:
   apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
   sudo touch /var/lib/cloud/instance/locale-check.skip
_____________________________________________________________________

Did try the following command :

   sudo apt-get install language-pack-UTF-8
     or
   sudo locale-gen UTF-8

But still nothing happened, each time I'm installing a package, still invoking the same warning. Any clues what had happened?

Thanks,

3 comments
  • Debian or Ubuntu fix locales, example for en_US.UTF-8

    locale
    
    export LANGUAGE=en_US.UTF-8; export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; locale-gen en_US.UTF-8
    
    dpkg-reconfigure locales
    
    reboot
    

    Don't worry, be happy.

  • Hi @sail7, when I typed in locale, I got:

    LANG=
    LC_COLLATE="C"
    LC_CTYPE="UTF-8"
    LC_MESSAGES="C"
    LC_MONETARY="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_ALL=
    

    Then as you suggested, I tried:
    export LANGUAGE=en_US.UTF-8; export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; locale-gen en_US.UTF-8
    and I got:
    -bash: locale-gen: command not found

    I've been googling but haven't found the solution. What else should I do?
    Thanks a lot!

  • Edit the file /etc/default/locale :
    sudo nano /etc/default/locale

    LANG="en_US.UTF-8"
    LC_MESSAGES=POSIX
    

    And the file /etc/environment :
    sudo nano /etc/environment

    LC_ALL=en_US.UTF-8
    LANGUAGE=en_US.UTF-8
    
2 Answers

I have the same problemsssss

I also used this script and everything now is working fine!

https://jee-appy.blogspot.mx/2016/02/set-locale-on-ubuntu-permanent-solution.html

I hope it could be useful!

Have another answer? Share your knowledge.