Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why my gentoo have different locale for root?
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
simonbcn
n00b
n00b


Joined: 01 Aug 2011
Posts: 63
Location: Terrassa, Barcelona, Spain

PostPosted: Wed Jan 13, 2016 6:28 pm    Post subject: Why my gentoo have different locale for root? Reply with quote

I have defined my locales with systemd:
Code:
$ localectl set-locale LANG="es_ES.UTF-8" LC_COLLATE="C"


My /etc/env.d/02locale:
Code:
LANG=es_ES.UTF-8
LC_COLLATE=C

Code:
$ egrep "LAN|LC" /etc/profile.env                                     
export LANG='es_ES.UTF-8'
export LC_COLLATE='C'


With my user:
Code:
$ locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE=C
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

Code:
$ localectl
   System Locale: LANG=es_ES.UTF-8
                  LC_COLLATE=C
       VC Keymap: es
      X11 Layout: es
       X11 Model: pc105
     X11 Options: terminate:ctrl_alt_bksp


I open a root session with "su -" and:
Code:
locale                                                                                                                 
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=

But:
Code:
$ localectl                                                                                                           
   System Locale: LANG=es_ES.UTF-8
                  LC_COLLATE=C
       VC Keymap: es
      X11 Layout: es
       X11 Model: pc105
     X11 Options: terminate:ctrl_alt_bksp


Is this a bug or a wrong configuration?
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1654
Location: United Kingdom

PostPosted: Wed Jan 13, 2016 7:12 pm    Post subject: Reply with quote

Below is the procedure I used the last time I changed the locale in an installation using systemd, which was over a year ago:

1. List the current locale:

Code:
# localectl list-locales
en_US
en_US.iso88591
en_US.utf8

2. Edit the locale.gen file:

Code:
# nano /etc/locale.gen

I wanted to have just British English and Brazilian Portuguese, so I made the file contain only the following:

Code:
en_GB.UTF-8 UTF-8
en_GB ISO-8859-1
pt_BR.UTF-8 UTF-8
pt_BR ISO-8859-1

If I only wanted one language (I’ll use Brazilian Portuguese as an example), I would have made it contain the following instead:

Code:
pt_BR.UTF-8 UTF-8
pt_BR ISO-8859-1

3. Generate the locale(s) I want:

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

4. List the locales I have configured, just to be sure:

Code:
# localectl list-locales
en_GB
en_GB.iso88591
en_GB.utf8
pt_BR
pt_BR.iso88591
pt_BR.utf8

5. Set the language I want to use:

Code:
# localectl set-locale LANG=pt_BR.UTF-8

6. List the console keymaps available:

Code:
# localectl list-keymaps

7. Chose the console keymap I wish to use:

Code:
# localectl set-keymap br-abnt2

N.B. The above systemd command does not change the console keymap specified in /boot/grub/grub.cfg, so I had to fix that later by editing /etc/default/grub and running grub2-mkconfig -o /boot/grub/grub.cfg, as I show further on.

8. List the X11 keymaps available:
Code:
# localectl list-x11-keymap-layouts


9. Chose the X11 keymap I wish to use:
Code:
# localectl set-x11-keymap br


10. Update the environment variables and profile to adopt what I specified:
Code:
# env-update && source /etc/profile


11. Set the required console keymap specified in grub.cfg as follows:

Code:
# nano /etc/default/grub

Add “vconsole.keymap=br-abnt2“ to the list in environment variable GRUB_CMDLINE_LINUX (default entry and recovery mode entry) or GRUB_CMDLINE_LINUX_DEFAULT (default mode entry only).

Code:
# grub2-mkconfig -o /boot/grub/grub.cfg

12. Reboot:
Code:
# systemctl reboot

_________________
Clevo W230SS: amd64 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
simonbcn
n00b
n00b


Joined: 01 Aug 2011
Posts: 63
Location: Terrassa, Barcelona, Spain

PostPosted: Wed Jan 13, 2016 7:15 pm    Post subject: Reply with quote

ok, it's that I did. But when I execute "su -" the root has different locale but if I execute "su", it has the same locale.
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