# Fixing Perl Warning Setting Locale Failed Error Message on Ubuntu/Debian

If you run across Ubuntu/Debian perl or shell script and see the following locale error:

perl: warning: Setting locale failed.
LANGUAGE = (unset),
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").

Then it is more likely that your Ubuntu/Debian locale is not configured properly. I had found this error messages when I was trying to activate tightvncserver on my Raspberry Pi running a Debian Wheezy like below:

pi@raspi ~ $tightvncserver perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), 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"). New 'X' desktop is raspi:1 Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspi:1.log pi@raspi ~$

To get rid of this error, I execute the following command as root and make sure that your current user are a sudoer or currently allowed to execute sudo command:

pi@raspi: ~ $sudo -i password: root@raspi:~ # dpkg-reconfigure locales perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = "en_US.UTF-8", LC_CTYPE = "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_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 /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory ... at this point, select your desired locale settings, ... select only locale settings you need ... AND uncheck/untick the All locale, ... otherwise your system will generate all locale which takes a long time ... then select your desired default locale ... in my case, I only configure all en_US locale and set en_US as the default locale Generating locales (this might take a while)... en_US.ISO-8859-1... done en_US.ISO-8859-15... done en_US.UTF-8... done Generation complete. root@raspi:~ # exit pi@raspi: ~$

Try to execute the former shell command that show you the locale error. This time, you won’t see the locale error anymore. Great!

pi@raspi ~ $vncserver -kill :1 Can't find file /home/pi/.vnc/raspi:1.pid You'll have to kill the Xtightvnc process manually pi@raspi ~$ tightvncserver

New 'X' desktop is raspi:1

Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspi:1.log

pi@raspi ~ $vncserver -kill :1 Killing Xtightvnc process ID 11604 pi@raspi ~$