Tip: Debian Lenny locales (perl) warning messages
Purpose: Lot of time when you upgrade/downgrade Debian OS, you might end up getting some locale warnings (or error) messages on your system whenever you give any commands like “man cp”, “apt-get upgrade”, etc. Many people try tirelessly to get rid of those messages but they can’t seem to even after trying many solutions found on the Internet. In this short blog entry we will see how to get rid of these locale/perl annoying error messages.
If you are getting any of the following warning/error messages then most probably following the solution that is suggested will take care of your problem on Debian Lenny.
Warnings/Error Messages:
can't set the locale; make sure $LC_* and $LANG are correct
or
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
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
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
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
Solution #1
First give the following commands:
apt-get update
apt-get belocs-locales-bin belocs-locales-data
apt-get install belocs-locales-bin belocs-locales-data
Note: The above command will most likely remove the package “locales” since they are mutually exclusive.
Now edit the following file:
debian:~# nano /etc/locale.gen
and make sure that you have at least one of the locales selected (un-commented) in the file:
........
........
# en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
en_US.UTF-8 UTF-8
# en_ZA ISO-8859-1
# en_ZA.UTF-8 UTF-8
..........
..........
Save and quit.
Now give the following command:
debian:~# locale-gen
Generating locales...
en_US.UTF-8... done
Generation complete.
With this your locale/perl warnings should go away.
Solution #2
In case if you are still not able to get rid of these messages, then follow these steps:
apt-get update
apt-get install locales
dpkg-reconfigure locales
and select en_US.UTF-8 as shown below:
and then
After hitting “OK” you will see something like this:
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
debian-workstation:~#
As usual, please leave a comment/feedback if you have any. Also please don’t forget to rate this post below.



Free Email Subscription









February 13th, 2009 at 10:45 pm
[...] your system whenever you give any commands like “man cp”, “apt-get upgrade”, etc. Read it here Many people try tirelessly to get rid of those messages but they can’t seem to even after trying [...]
February 13th, 2009 at 11:14 pm
apt-get belocs-locales-bin belocs-locales-dataI think you mean:
apt-get belocs-locales-bin belocs-locales-dataReply to this comment
February 13th, 2009 at 11:14 pm
apt-get install belocs-locales-bin belocs-locales-data
Reply to this comment
Kushal Reply:
February 13th, 2009 at 11:30 pm
Thanks for correcting, Foo.
I liked your email…:)
Reply to this comment
April 11th, 2009 at 8:44 am
I’m on debian 5.0 lenny amd64, and after following the steps above, I still have problems, when it gets to generating en_CA.UTF-8 and en_US.UTF-8 the comp just hangs. Some of the ISO locales seem to generate correctly though.
Reply to this comment
Admin Reply:
April 11th, 2009 at 2:54 pm
Thank you for your comment. What happens if you just generate one locale – say en_US.UTF-8? Does everything work fine with that?
Reply to this comment
September 1st, 2009 at 2:57 am
Hi,
I am upgrading ubuntu8.10 to 9.04 but I am not able to install ubuntu-desktop received the perl warning mention in ur post. Also try to install locals then received the folwing errro. Googling it but not received any solutions,
apt-get install locales
Reading package lists… Done
Building dependency tree… Done
You might want to run `apt-get -f install’ to correct these:
The following packages have unmet dependencies:
gnome-utils: Depends: libgnome-desktop-2-11 (>= 1:2.25.90) but it is not going to be installed
libcairo2: Depends: libxcb1 (>= 1.1.92) but 1.1-1ubuntu1 is to be installed
libx11-6: Depends: libxcb1 (>= 1.1.92) but 1.1-1ubuntu1 is to be installed
libxcb-render0: Depends: libxcb1 (>= 1.1.92) but 1.1-1ubuntu1 is to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).
give me solution, plz.
Reply to this comment
Admin Reply:
September 23rd, 2009 at 10:57 pm
Hi,
Go through this post:
http://blogs.koolwal.net/2009/03/30/a-comprehensive-command-guide-to-debians-apt-get-and-dpkg/
and one or the other solution will almost definitely work for you. What you are facing is a common problem during upgrade.
Reply to this comment
September 7th, 2009 at 7:10 am
Thank’s about your procedure. But it’s strange, if I apply it (manualy or with aptitude), nothing appends!
Is a reboot needed?
Hervé
Log :
—–
# dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “fr_FR”,
LANG = “fr_FR@euro”
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
Generating locales (this might take a while)…
fr_FR.UTF-8… done
fr_FR.ISO-8859-15@euro… done
fr_FR.UTF-8… done
Generation complete.
# perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “fr_FR”,
LANG = “fr_FR@euro”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
—– Aptitude log
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “fr_FR”,
LANG = “fr_FR@euro”
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
Gtk-WARNING **: Locale not supported by C library.
Using the fallback ‘C’ locale. at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 54, line 1.
Gdk-WARNING **: locale not supported by C library at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 54, line 1.
Gtk-WARNING **: Locale not supported by C library.
Using the fallback ‘C’ locale. at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 60, line 1.
Gdk-WARNING **: locale not supported by C library at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 60, line 1.
Preconfiguring packages …
(Reading database … 117939 files and directories currently installed.)
Preparing to replace locales 2.7-18 (using …/locales_2.7-18_all.deb) …
Unpacking replacement locales …
Processing triggers for man-db …
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “fr_FR”,
LANG = “fr_FR@euro”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
/usr/bin/mandb: can’t set the locale; make sure $LC_* and $LANG are correct
Setting up locales (2.7-18) …
Generating locales (this might take a while)…
fr_FR.UTF-8… done
fr_FR.ISO-8859-15@euro… done
fr_FR.UTF-8… done
Generation complete.
same result!
Reply to this comment
Admin Reply:
September 23rd, 2009 at 10:55 pm
Hi,
You are right. In my experience, editing the local.gen file always have worked. Solution #2 sometimes work and sometimes it does not.
Reply to this comment
September 16th, 2009 at 9:15 am
[...] [...]
October 10th, 2009 at 3:13 am
some time i try to fix this and today a howto that work without difference.
i can complette my update and everything is working now.
thank you
Reply to this comment