Fixing the pesky perl: warning: Setting locale failed on Ubuntu Server


After having installed an new instance of Ubuntu Server, I run into the following error message

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

To fix it, I had to do the following:

$ sudo dpkg-reconfigure locales

That generated the following output:

Generating locales...
  en_AG.UTF-8... up-to-date
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... up-to-date
  en_GB.UTF-8... up-to-date
  en_HK.UTF-8... up-to-date
  en_IE.UTF-8... up-to-date
  en_IN.UTF-8... up-to-date
  en_NG.UTF-8... up-to-date
  en_NZ.UTF-8... up-to-date
  en_PH.UTF-8... up-to-date
  en_SG.UTF-8... up-to-date
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZM.UTF-8... up-to-date
  en_ZW.UTF-8... up-to-date
Generation complete.

Then, I ran:

$ sudo locale-gen en_GB

That generated the following output:

Generating locales...
  en_GB.ISO-8859-1... done
Generation complete.

And I eventually ran:

$ sudo update-locale LANG=en_GB.UTF-8

Then, I added the following to my .profile

export LC_CTYPE=en_GB.UTF-8 export LC_ALL=en_GB.UTF-8

That did the trick.

Advertisements

3 Responses to Fixing the pesky perl: warning: Setting locale failed on Ubuntu Server

  1. I had this problem when running “git”, and I tried everything mentioned here, until I realized
    that the problem was the locale of the git server, and not on the local machine…

  2. owijeofijweoifjwoiejfoiwejfoiwjefoijweofj says:

    YES!!! Thanks a lot, the exports did the trick. THX!!!!!!!!

  3. Pingback: How to: How can I fix a locale warning from perl? | SevenNet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: