Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Issues setting locale on a new setup...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Tue May 08, 2007 1:47 pm    Post subject: [Solved] Issues setting locale on a new setup... Reply with quote

Hi...
Trying to get a new gentoo machine set up with a proper profile, including:
Code:

en_US
en_US.utf8


When I run locale, I get the following, which is bothersome with regard to the lack of a "default locale":
Code:

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.utf8 en_US
LC_CTYPE="en_US.utf8 en_US"
LC_NUMERIC="en_US.utf8 en_US"
LC_TIME="en_US.utf8 en_US"
LC_COLLATE="en_US.utf8 en_US"
LC_MONETARY="en_US.utf8 en_US"
LC_MESSAGES="en_US.utf8 en_US"
LC_PAPER="en_US.utf8 en_US"
LC_NAME="en_US.utf8 en_US"
LC_ADDRESS="en_US.utf8 en_US"
LC_TELEPHONE="en_US.utf8 en_US"
LC_MEASUREMENT="en_US.utf8 en_US"
LC_IDENTIFICATION="en_US.utf8 en_US"
LC_ALL=en_US.utf8 en_US


And with each reboot, locale reverts to:
Code:
# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

The gentoo documentation instructs to set default locale in /etc/env.d/02locale. The problem is that I don't have that file... :?

Where do I need to go with this??

Thanks!
_________________
"Primum non nocere" ---Galen


Last edited by cgmd on Wed May 09, 2007 2:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
TheAl
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2004
Posts: 134

PostPosted: Tue May 08, 2007 2:16 pm    Post subject: Reply with quote

Be sure to get a correct glibc locales files :
Code:
# /etc/locale.gen: list all of the locales you want to have on your system
#
# The format of each line:
# <locale> <charmap>
#
# Where <locale> is a locale located in /usr/share/i18n/locales/ and
# where <charmap> is a charmap located in /usr/share/i18n/charmaps/.
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you.  After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.

en_US ISO-8859-1
en_US.UTF-8 UTF-8


Then build your files :
Code:
locale-gen


More infos here :
http://www.gentoo.org/doc/en/guide-localization.xml
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Tue May 08, 2007 2:17 pm    Post subject: Reply with quote

What do you have in /etc/locale.gen?

Make sure it contains
Code:
en_US.UTF-8 UTF-8
en_US ISO-8859-1
then try running locale-gen.

You can just create /etc/env.d/02locale yourself, the "syntax" is the same as the output of the locale command,
so `locale >> /etc/env.d/02locale` is a good place to start.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
PsychoticRetina
Guru
Guru


Joined: 18 Dec 2005
Posts: 352
Location: behind the scalpel

PostPosted: Tue May 08, 2007 2:22 pm    Post subject: Reply with quote

according to this, it seems you just create it. (i dont speak german though). id go for LANG="default" and see what happens. :D
_________________
there are pinheads everywhere.
penguins are no exception.
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Tue May 08, 2007 2:28 pm    Post subject: Reply with quote

My /etc/locale.gen:

Code:
# /etc/locale.gen: list all of the locales you want to have on your system

en_US ISO-8859-1
en_US.UTF-8 UTF-8


Then:
Code:
# locale-gen
 * Generating 2 locales (this might take a while) with 1 jobs
 *  (1/2) Generating en_US.ISO-8859-1 ...                                                                         [ ok ]
 *  (2/2) Generating en_US.UTF-8 ...                                                                              [ ok ]
 * Generation complete

 # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
chuxtux linux

# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I'm not sure what I'm missing, here... :?

Thanks!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Tue May 08, 2007 2:36 pm    Post subject: Reply with quote

cgmd wrote:
I'm not sure what I'm missing, here... :?

Thanks!
Hopeless wrote:
You can just create /etc/env.d/02locale yourself, the "syntax" is the same as the output of the locale command,
so `locale >> /etc/env.d/02locale` is a good place to start.

After doing the above to create /etc/env.d/02locale, edit it to your liking (by changing POSIX to either en_US or en_US.utf8 for example),
then env-update && source /etc/profile.

You might have to log out and back in for the changes to take effect (or just start a new login shell).
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Tue May 08, 2007 3:04 pm    Post subject: Reply with quote

Hopeless...
Per your suggestion, I created /etc/env.d/02locale, but just with LANG= and LC_ALL= (set as follows):
Code:
 # cat /etc/env.d/02locale
LANG="en_US en_US.utf8"
LC_ALL="en_US en_US.utf8"


After env-update && source /etc/profile, as well as reboot, I now get:
Code:

# 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 en_US.utf8
LC_CTYPE="en_US en_US.utf8"
LC_NUMERIC="en_US en_US.utf8"
LC_TIME="en_US en_US.utf8"
LC_COLLATE="en_US en_US.utf8"
LC_MONETARY="en_US en_US.utf8"
LC_MESSAGES="en_US en_US.utf8"
LC_PAPER="en_US en_US.utf8"
LC_NAME="en_US en_US.utf8"
LC_ADDRESS="en_US en_US.utf8"
LC_TELEPHONE="en_US en_US.utf8"
LC_MEASUREMENT="en_US en_US.utf8"
LC_IDENTIFICATION="en_US en_US.utf8"
LC_ALL=en_US en_US.utf8

Making progress, but still have to deal with:
Quote:

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


Any thoughts?

Thanks!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Tue May 08, 2007 3:08 pm    Post subject: Reply with quote

Could be wrong, but I think you can only have one or the other, not both, so do you need unicode or not?
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
TheAl
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2004
Posts: 134

PostPosted: Tue May 08, 2007 3:35 pm    Post subject: Reply with quote

Yes, you should only have one :
Code:
 # cat /etc/env.d/02locale
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Tue May 08, 2007 3:35 pm    Post subject: Reply with quote

Hopeless...
Well, I was following the gentoo upgrading guide:
Quote:
Updating to 2007.0 or 2006.1

If you intend to upgrade to these profiles, you should be aware that they expect the system to be set to a Unicode locale by default; specifically that UNICODE="yes" is set in /etc/rc.conf. For this to work, you must have created a Unicode locale for your system to use. Please read our UTF-8 guide to learn how to create the proper locale.

Which started my quest...

If I must choose between en_US or en_US.utf8, my question would be what do I "give up" if I opt for unicode as my default? In that regard, I'm clueless... :?

Any advice?

Thanks!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
baldeante
Guru
Guru


Joined: 17 Jan 2004
Posts: 498
Location: Caldas da Rainha, Portugal

PostPosted: Tue May 08, 2007 6:31 pm    Post subject: Reply with quote

Hello,

Try this at your /etc/env.d/02locale

Code:

LANG=en_US.UTF-8
LC_CTYPE=en_US
LC_NUMERIC=en_US
LC_TIME=en_US
LC_COLLATE=en_US
LC_MONETARY=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_MESSAGES=en_US


I change mine to get yours

My /etc/env.d/02locale
Code:

LANG=en_US.UTF-8
LC_CTYPE=pt_PT@euro
LC_NUMERIC=pt_PT@euro
LC_TIME=pt_PT@euro
LC_COLLATE=pt_PT
LC_MONETARY=pt_PT@euro
LC_PAPER=pt_PT@euro
LC_NAME=pt_PT@euro
LC_ADDRESS=pt_PT@euro
LC_TELEPHONE=pt_PT@euro
LC_MEASUREMENT=pt_PT@euro
LC_IDENTIFICATION=pt_PT@euro
LC_MESSAGES=en_US



You may have to check your kernel if i'm not mistaken you must have the correct code page set

If i'm not mistaken in you case you must have on your /usr/src/linux/.config the this line
Code:

CONFIG_NLS_CODEPAGE_437=y
// if you compile it on the kernel

or
Code:

CONFIG_NLS_CODEPAGE_437=m
// if you compile it as a module in this case you must load it an /etc/modules.autoload/kernel-2.6


After setting Try this at your /etc/env.d/02locale do this :

Code:

env-update
etc-update
source /etc/profile
locale-gen
emerge system -uD --newuse
emerge world -uD --newuse


This will recompile in your system all packages that may need to be changed after 02locale change
_________________
Never Quit, Never Get Mad, Get Even
Back to top
View user's profile Send private message
baldeante
Guru
Guru


Joined: 17 Jan 2004
Posts: 498
Location: Caldas da Rainha, Portugal

PostPosted: Tue May 08, 2007 6:53 pm    Post subject: Reply with quote

Forgot to mention /etc/locale.gen


Here is mine

Code:

en_US ISO-8859-1
en_US ISO-8859-15
en_US.UTF-8 UTF-8
pt_PT ISO-8859-1
pt_PT@euro ISO-8859-15
pt_PT.UTF-8 UTF-8


I don't think you will need the last 3 lines

And maybe you can loose the first or second but you will need one of them.

In any case in you kernel .config file you may need one or both of this lines :

Code:

CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" // i guess you may choose to go for iso8859-15
CONFIG_NLS_DEFAULT="iso8859-1" // i guess you may choose to go for iso8859-15

CONFIG_NLS_ISO8859_1="y"
CONFIG_NLS_ISO8859_15="y"

_________________
Never Quit, Never Get Mad, Get Even
Back to top
View user's profile Send private message
TheAl
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2004
Posts: 134

PostPosted: Tue May 08, 2007 8:48 pm    Post subject: Reply with quote

cgmd wrote:

...

Which started my quest...

If I must choose between en_US or en_US.utf8, my question would be what do I "give up" if I opt for unicode as my default? In that regard, I'm clueless... :?

Any advice?

Thanks!


I'm using UTF-8 since 2 years, but because I've some french apps, and UTF-8 provide a reliable way to print special chars.

IMOO, you should stay UTF8 as much as you can; i know some special place where you can use ISO for performance (perl for example).
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Tue May 08, 2007 9:38 pm    Post subject: Reply with quote

baldeante...

Thank you for your posts...

I have adapted almost all of my configuration to your suggestions, with the exception of using NLS ISO 8859-15 (Latin 9; Western European Languages with Euro), in either my kernel config or in /etc/locale.gen.

Happily, I can report that I now have the following:
Code:

# locale
LANG=en_US.UTF8
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=

Niether emerge system -uD --newuse or emerge world -uD --newuse forced any packages to recompile, I guess since I previously had the unicode USE flag set in /etc/make.conf. :?

In any case, it looks like I may now working configuration to enable using unicode. :)

Thanks, again, for your help with this!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
baldeante
Guru
Guru


Joined: 17 Jan 2004
Posts: 498
Location: Caldas da Rainha, Portugal

PostPosted: Wed May 16, 2007 7:50 am    Post subject: Reply with quote

cgmd wrote:
baldeante...

Thank you for your posts...

I have adapted almost all of my configuration to your suggestions, with the exception of using NLS ISO 8859-15 (Latin 9; Western European Languages with Euro), in either my kernel config or in /etc/locale.gen.

Happily, I can report that I now have the following:
Code:

# locale
LANG=en_US.UTF8
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=

Niether emerge system -uD --newuse or emerge world -uD --newuse forced any packages to recompile, I guess since I previously had the unicode USE flag set in /etc/make.conf. :?

In any case, it looks like I may now working configuration to enable using unicode. :)

Thanks, again, for your help with this!



No need to thanks :wink: i'm just glad to be able to help as i have been helped many times on this forum :wink:
_________________
Never Quit, Never Get Mad, Get Even
Back to top
View user's profile Send private message
hcintra
n00b
n00b


Joined: 27 Jan 2005
Posts: 51

PostPosted: Mon Jan 28, 2008 4:22 pm    Post subject: Funny Reply with quote

I am pretty sure that cgmd already had the correct locales, once he had wrote a locale.gen file and built locales using locale-gen. He was upset by running the locale command and receiving POSIX as its variable, but that was right. If he had ran locale -a he would have seen both of the environment variables he was commanding his system to use.

As he used the wrong command and got wrong conclusions, the whole topic went on defining /etv/env.d/02locale, which is used to set system default not options. POSIX is right for letting userspace applications choose what they need.

The errors cgmd had afterwards where caused by defining LC-ALL with a locale name (language code en + underscore + country code) plus a codepage (iso8859* utf* ascii ...) That is what the message

Code:

locale: Cannot set LC_CTYPE to default locale: No such file or directory


is complaining about. Why would you want to set a character map to things like measurements, time, date and languages for your messages?

Now, I would guess that all LC_*** parameters set with UTF-8 after the locale name are being ignored. I am pretty sure that this generates no errors as I have put set bogus parameter on my 02locale file for LC_MEASUREMENTS without anything going wrong. As I am pretty sure that settings by baldeante are all being discarded, because he hasn't used "" in his statements at 02locale. Therefore, cgmd got no mistakes at the end because his whole set of definitions where being ignored. :D

The rc.conf variable UNICODE has to do with the console keymap only and will have no effect unless you define an unicode keymap in /etc/conf.d/keymaps, for which Hopeless is right, you can only have one option. Within X you can have many, and you can have a default. Locales.gen creates options, /etc/env.d/02locale sets default. Posix is right if you want to set no default, keeping the existent "en", which is the fall back for every application.

Then there is the question, why do you want unicode? If it is for applications to able to display foreign characters, there is nothing you should change at locales at all. You just need the correct code pages in kernel, with "unicode" and "nls" USE flags set on, but I am pretty sure that once you have set up unicode and nls in your kernel, you don't even need to bother including those flags no your make.conf. I haven't and my emerge --info show both of then enable as they are being inherited from my basic profile.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum