locale errors on Ubuntu

Linux Locale errors

For some reason, I keep coming across Ubuntu machines that are missing the language-pack appropriate to their end user. If you happen to 'acquire' one of these, you'll see messages like :

svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is en_GB.UTF-8
svn: warning: please check that your locale name is correct

or

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_GB.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

The solution is a simple :

apt-get install language-pack-en

(Obviously not -en if you're not English speaking)

And it goes away.

Technorati Tags:

Comments

I get these sorts of errors

I get these sorts of errors with Perl scripts, sadly even with language-pack-en installed :-(

really?

It makes them go away for me :-/

set LANGUAGE manually

I've got a fresh CLI Edgy install and have the same problem after updating.
Reinstalled the language-pack-en without success. Installed localeconf
which didn't help either.

I suspect this variable has been obsoleted as I read elsewhere LANG is all
that is required. My fix was to manually edit /etc/environment to:


LANG="en_CA.UTF-8"
LANGUAGE=$LANG

Good luck!

I tried it on my ubuntu box

I tried it on my ubuntu box and it finally fixed my perl warnings!

thanks!

excellent :)

I'm glad it fixed your problem(s).... :)

David.

Alternative solution

The language-pack-en did not solve my problem which sent me back to Google. I found this page[1] which suggested the following:

sudo locale-gen en_US.UTF-8

That worked. I don't know if it was the combination of both or just the latter that ultimately fixed it. Thanks for the hints.

William

[1] http://juicebar.wordpress.com/2007/01/17/installing-postgresql-on-ubuntu-606-problems/

In my case en_US was noted

In my case en_US was noted as "up-to-date" and was not generated when invoking sudo locale-gen en_US.UTF-8.

By simply adding the purge option to locale-gen, it worked for me:
sudo locale-gen --purge en_US.UTF-8

Alternate Solution works for me

Thanks, the alternate solution worked for me. :)

Neither of those ways worked for me

I'm not sure why, but neither of these methods worked for me.

Some help would be greatly appreciated.

Any ideas which of these packages fixes it?

Any idea which of these packages that language-pack-en depends on fixes it? Because at 138MB it counts as being approximately twice as big as the entire rest of the operating system:


andy@hobbes:~$ sudo aptitude install language-pack-en
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
aspell aspell-en bsh ca-certificates cpp cpp-4.1 debconf-utils defoma dictionaries-common file fontconfig fontconfig-config gcj-4.1-base gij
gij-4.1 hicolor-icon-theme language-pack-en-base language-support-en libaspell15 libatk1.0-0 libatk1.0-data libaudio2 libcairo2 libcupsys2
libcurl3 libflac7 libfontconfig1 libfontenc1 libfreetype6 libft-perl libgcj-bc libgcj-common libgcj7-0 libgcj7-jar libglib2.0-0 libglib2.0-data
libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libice6 libicu34 libidn11 libjaxp1.2-java
libjline-java libjpeg62 libneon25 libpango1.0-0 libpango1.0-common libpng12-0 libportaudio0 libsm6 libsndfile1 libstartup-notification0
libstlport4.6c2 libtiff4 libttf2 libwpd8c2a libx11-6 libx11-data libxalan2-java libxau6 libxaw7 libxcursor1 libxdmcp6 libxerces2-java libxext6
libxfixes3 libxfont1 libxft2 libxi6 libxinerama1 libxmlsec1 libxmlsec1-nss libxmlsec1-openssl libxmu6 libxpm4 libxrandr2 libxrender1 libxslt1.1
libxt-java libxt6 mozilla-firefox-locale-en-gb myspell-en-gb myspell-en-us openoffice.org-common openoffice.org-core openoffice.org-help-en-us
openoffice.org-java-common openoffice.org-l10n-common openoffice.org-l10n-en-gb openoffice.org-l10n-en-za openoffice.org-style-crystal
openoffice.org-style-default openoffice.org-style-hicontrast openoffice.org-style-industrial openoffice.org-thesaurus-en-us
openoffice.org-writer python-central python-uno sessreg sgml-base thunderbird-locale-en-gb ttf-dejavu ttf-opensymbol ucf wamerican wbritish
x-ttcidfont-conf xcursorgen xfonts-encodings xfonts-utils xml-core xutils xutils-dev
The following NEW packages will be installed:
aspell aspell-en bsh ca-certificates cpp cpp-4.1 debconf-utils defoma dictionaries-common file fontconfig fontconfig-config gcj-4.1-base gij
gij-4.1 hicolor-icon-theme language-pack-en language-pack-en-base language-support-en libaspell15 libatk1.0-0 libatk1.0-data libaudio2
libcairo2 libcupsys2 libcurl3 libflac7 libfontconfig1 libfontenc1 libfreetype6 libft-perl libgcj-bc libgcj-common libgcj7-0 libgcj7-jar
libglib2.0-0 libglib2.0-data libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libice6 libicu34
libidn11 libjaxp1.2-java libjline-java libjpeg62 libneon25 libpango1.0-0 libpango1.0-common libpng12-0 libportaudio0 libsm6 libsndfile1
libstartup-notification0 libstlport4.6c2 libtiff4 libttf2 libwpd8c2a libx11-6 libx11-data libxalan2-java libxau6 libxaw7 libxcursor1 libxdmcp6
libxerces2-java libxext6 libxfixes3 libxfont1 libxft2 libxi6 libxinerama1 libxmlsec1 libxmlsec1-nss libxmlsec1-openssl libxmu6 libxpm4
libxrandr2 libxrender1 libxslt1.1 libxt-java libxt6 mozilla-firefox-locale-en-gb myspell-en-gb myspell-en-us openoffice.org-common
openoffice.org-core openoffice.org-help-en-us openoffice.org-java-common openoffice.org-l10n-common openoffice.org-l10n-en-gb
openoffice.org-l10n-en-za openoffice.org-style-crystal openoffice.org-style-default openoffice.org-style-hicontrast
openoffice.org-style-industrial openoffice.org-thesaurus-en-us openoffice.org-writer python-central python-uno sessreg sgml-base
thunderbird-locale-en-gb ttf-dejavu ttf-opensymbol ucf wamerican wbritish x-ttcidfont-conf xcursorgen xfonts-encodings xfonts-utils xml-core
xutils xutils-dev
0 packages upgraded, 117 newly installed, 0 to remove and 0 not upgraded.
Need to get 138MB of archives. After unpacking 386MB will be used.
Do you want to continue? [Y/n/?]

Cheers,
Andy

Ah-ha!

Ah, it's mostly likely because I used aptitude - the dependency is only a recommends. apt-get most likely wouldn't have pulled all that in.

Cheers,
Andy

In a

In a linux-vserver-environment none of the solutions worked, but I have found a workaround for the bash:

apt-get install language-pack-** or locale-gen en_GB.UTF-8 or the language you want.

manually edit /etc/bash.bashrc and set there the LANG-variable by including the following line:

LANG=en_GB.UTF-8

or whatever you want to be the standard locale. Every user can set it's own standard language by editing the .bashrc-file in it's home-directory.

A problem is that this sets the standard locale only for the bash and scripts invoked by it, so I would be glad to get comments on this workaround.

The problem is in the

The problem is in the /usr/lib/locale/ dir, where bash tries to get the aproppiate locale set in the LANG variable. There is no en_US dir in there, but if you sudo ln -s en_US.utf8 en_US it also works even with LANG=en_US set in the .bashrc file, because now it can find the en_US entry.

Solution

You don't really need to install anything, just like Dan above pointed out, your locale might be missing, all you have to do on Debian/Ubuntu is

dpkg-reconfigure locales

:thumbsup:

Confirmed to fix the issue in a vserver env.

Thanks Dan Because of i set

Thanks Dan

Because of i set #LANG=EN, but the /usr/lib/locale/ dir have no EN.

So, i LANG=en_US, it is works.

I tried the following

I tried the following solutions (with everything working by the third solution)

first I tried editing /etc/environment
then I tried installing language-pack-en (but this package didnt exist for debian, perhaps because of the repos I was using)

finally I installed locales-all (which just worked (tm))

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Et tu Roboto?