2

Fixing Perl Locale Errors in a Clean Ubuntu Install

Posted April 6th, 2011 (Updated 29 Oct 2011) in Linux

When performing various actions on a clean install of Ubuntu 10.10 on my web server, I kept being presented with the following message:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:en",
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

After some googling, many people (in this thread http://ubuntuforums.org/showthread.php?t=138022) suggested:

sudo locale-gen
sudo dpkg-reconfigure locales

however the solution that worked for me was:

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

You might need to reset your machine before changes take effect:

sudo shutdown -r now
  • Hass

    2 years on this works just fine ;) Thanks heaps!

  • Marijn

    “dpkg-reconfigure locales”
    requires as sudo command, just as in the upper example
    - Using Ubuntu 12.04 server