If you receive Perl errors during apt-get commands or other similar LANG based errors when using the man command such as the following: root@ubuntu:/# man x man: can't set the locale; make sure $LC_* and $LANG are correct The resolution is as follows: Ubuntu Dapper Solution: locale-gen en_US -------------------------------------------------------------------------------- The following information is notes taken trying to resolve the problem... What do you have them set to? I have "LANG=en_US.UTF-8; export LANG" (in .profile) with the following in locale.gen: "en_US.UTF-8 UTF-8". As some man pages contain stuff that do not render right, I often do: LANG=C man ... locale locale -a apt-cache policy language-pack-en BULK SOLUTION: language-pack-en (installs language-pack-en-base) language-pack-en-base (installs language-pack-en) language-support-en (many packages including firefox and openoffice support) Please note that you should install language-support-en to get full support for this language. Simple Solution: locale-gen --aliases en_US.UTF-8 Long Solution (didn't really work with config files mis-named?) http://www.subterfugios.net/blog/ http://ubuntuforums.org/archive/index.php/t-6856.html (post by cscc_leth ) $ cd /usr/share/locales $ sudo ./install-language-pack en_US locale-gen en_US #equivalent... $ sudo nano /etc/locale.gen en_US ISO-8859-1 pt_PT ISO-8859-1 pt_BR ISO-8859-1 en_GB ISO-8859-1 $ sudo locale-gen $ sudo nano /etc/environment LANG="en_US" LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL="en_US" debian:~# find /usr -name en_US /usr/share/i18n/locales/en_US root@debian:/# locale 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 LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= /etc/environment written by Debian was: LANG="en_US" LANGUAGE="en_US:en_GB:en" which, while trying to resolve this I changed to: LANG="en_US" LANGUAGE="en_US" LC_ALL="en_US" dpkg-reconfigure locales tzconfig Solution: apt-get install locales dpkg-reconfigure locales apt-get install localeconf dpkg-reconfigure localeconf choose: en_US ECF 8 or "en_US.UTF-8" I fixed it It wasn't a keyboard issue I read on a few threads to install and reconfigure 'locales' When I tried apt-get install locales, it gave me some dependency issue (glibc-2.3.2.ds1-22). When I googled it, I guess it was a known bug. ??? Anyways, I worked around it and installed localeconf. I had to answer a lot of questions, but kept sticking with en_US ECF 8 or something like that. I had exactly the same problem. I found two solutions for this: 1. I upgraded my glib6c while I was installing some packages 2. I did dpkg-reconfigure localeconf (as mentioned above) Yes, while doing research, I found out that it is a known bug. -------------------------------------------------------------------------------- http://ubuntuforums.org/archive/index.php/t-6856.html (cscc_leth) I had the same problem, but through some lucky guessing, I seem to have something that works. I'm a relative linux newbie myself, but this worked for me. I will denote commands typed at a command prompt by $ $ sudo gedit /etc/locale.gen I changed this file to match that found here: http://igor.tamarapatino.org/escritos/conf/ss250n/files/locale.gen but only included those locales that I needed (the en_US and en_GB ones). Save and exit. $ sudo locale-gen This generates the locales as you've specified in your newly adjusted file. $ sudo gedit /etc/environment I changed this file by adding the following to the beginning (after LANGUAGE="en_GB:en_US:en") LANG=en_US LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL=en_US In other words, I forced it to use en_US for everything. Save and exit. Then, I logged out and logged back in. Everything seems to now work fine. In order to clean things up, I ran $ sudo dpkg-reconfigure locales and $ sudo dpkg-reconfigure localeconf Finally, I removed the manual changes I made to /etc/environment by doing $ sudo gedit /etc/environment and removing the lines I had added before. Everything seems to work brilliantly for me... since it seems that locale setting issues are relatively common, I hope this work around works for others (and that I didn't just get lucky!) -------------------------------------------------------------------------------- Internationalisation Variables This section describes environment variables that are relevant to the operation of internationalised interfaces described in the CAE Specification, System Interfaces and Headers, Issue 5 and the CAE Specification, Commands and Utilities, Issue 5. Users may use the following environment variables to announce specific localisation requirements to applications. Applications must retrieve this information using the setlocale() function to initialise the correct behaviour of the internationalised interfaces. The descriptions of the internationalisation environment variables describe the resulting behaviour only when the application locale is initialised in this way. LANG This variable determines the locale category for native language, local customs and coded character set in the absence of the LC_ALL and other LC_* (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) environment variables. This can be used by applications to determine the language to use for error messages and instructions, collating sequences, date formats, and so forth. LC_ALL This variable determines the values for all locale categories. The value of the LC_ALL environment variable has precedence over any of the other environment variables starting with LC_ (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and the LANG environment variable. LC_COLLATE This variable determines the locale category for character collation. It determines collation information for regular expressions and sorting, including equivalence classes and multi-character collating elements, in various utilities and the strcoll() and strxfrm() functions. Additional semantics of this variable, if any, are implementation-dependent. LC_CTYPE This variable determines the locale category for character handling functions, such as tolower(), toupper() and isalpha(). This environment variable determines the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters), the classification of characters (for example, alpha, digit, graph) and the behaviour of character classes. Additional semantics of this variable, if any, are implementation-dependent. LC_MESSAGES This variable determines the locale category for processing affirmative and negative responses and the language and cultural conventions in which messages should be written. It also affects the behaviour of the catopen() function in determining the message catalogue. Additional semantics of this variable, if any, are implementation-dependent. The language and cultural conventions of diagnostic and informative messages whose format is unspecified by this specification set should be affected by the setting of LC_MESSAGES. LC_MONETARY This variable determines the locale category for monetary-related numeric formatting information. Additional semantics of this variable, if any, are implementation-dependent. LC_NUMERIC This variable determines the locale category for numeric formatting (for example, thousands separator and radix character) information in various utilities as well as the formatted I/O operations in printf() and scanf() and the string conversion functions in strtod(). Additional semantics of this variable, if any, are implementation-dependent. LC_TIME This variable determines the locale category for date and time formatting information. It affects the behaviour of the time functions in strftime(). Additional semantics of this variable, if any, are implementation-dependent. NLSPATH This variable contains a sequence of templates that the catopen() function uses when attempting to locate message catalogues. Each template consists of an optional prefix, one or more substitution fields, a filename and an optional suffix. For example: NLSPATH="/system/nlslib/%N.cat"