You are not logged in.

#1 2012-08-29 10:12:37

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

[Solved] Cannot set locale (at first)

I don't think this is due to some trivial mistake (but then again, I've been wrong before). Anyway, I moved my system to systemd, and in /etc/locale.conf I have the following:

LANG=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=C

In /etc/locale.gen I have the following locales selected:
en_US.UTF-8 UTF-8
en_US ISO-8859-1
pt_PT.UTF-8 UTF-8
pt_PT ISO-8859-1
pt_PT@euro ISO-8859-15

When running locale-gen, I get the following output:

Generating locales...
  en_US.UTF-8... done
  en_US.ISO-8859-1... done
  pt_PT.UTF-8... done
  pt_PT.ISO-8859-1... done
  pt_PT.ISO-8859-15@euro... done
Generation complete.

However, after rebooting (I boot to console, no display manager), and logging in console, the locale that is set is POSIX! I start X with the following command (aliased in .bashrc):

. /etc/locale.conf ; export LANG ; exec nohup startx > /dev/null &vlock 

And after doing that, the locale, both in X and in console, is set to the correct one! (en_US.UTF-8)

Am I making a newbie mistake somewhere?

Last edited by gauthma (2013-05-16 19:31:28)

Offline

#2 2012-08-29 10:56:21

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [Solved] Cannot set locale (at first)

# pacman -Ql systemd-sysvcompat 
...
systemd-sysvcompat /etc/profile.d/locale.sh
...

I guess locale.sh does what you want, but you do not have installed systemd-sysvcompat ?

Offline

#3 2012-08-29 20:28:15

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

teateawhy wrote:
# pacman -Ql systemd-sysvcompat 
...
systemd-sysvcompat /etc/profile.d/locale.sh
...

I guess locale.sh does what you want, but you do not have installed systemd-sysvcompat ?

Actually I do have systemd-sysvcompat installed, but it does NOT have locale.sh. I do have that file, but it is owned by filesystem!

(sorry for the delay in replying, I was AFK)

EDIT: OK I just realized what happened. I'm using testing, and so my version of systemd-sysvcompat is 189-3, and this version no longer contains locale.sh (unlike the non testing version, 188). Now, at least according to https://wiki.archlinux.org/index.php/Systemd#Locale, it says that " /etc/profile.d/locale.sh from systemd-sysvcompat or initscripts is necessary to be able to set users' locale correctly", so I'm confused as to what to do next...

Last edited by gauthma (2012-08-29 20:40:01)

Offline

#4 2012-08-29 22:18:28

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [Solved] Cannot set locale (at first)

Maybe locale.sh is not executed at boot. You can test that by executing it on your own.
The fact that you are using testing is important here, maybe ask an admin to move this thread to the testing forum.

Offline

#5 2012-08-29 22:39:49

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

teateawhy wrote:

Maybe locale.sh is not executed at boot. You can test that by executing it on your own.
The fact that you are using testing is important here, maybe ask an admin to move this thread to the testing forum.

I didn't ask this in testing because I thought the issue was caused by some misconfiguration on my side... if an admin sees this thread as belonging in testing, well then he knows what to do smile

Anyway, I asked on irc, and it seems that the locale.sh script has been moved to the filesystem package. I'll do some more tests tomorrow, and post the results.

Offline

#6 2012-08-30 09:41:47

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

Logging in to bash, and executing /etc/profile.d/locale.sh yields no result. After running, I launched another bash process, but got the same change---i.e. nothing, the locale remains "POSIX"

Offline

#7 2012-08-30 09:57:32

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [Solved] Cannot set locale (at first)

gauthma wrote:
. /etc/locale.conf ; export LANG ; exec nohup startx > /dev/null &vlock 

And after doing that, the locale, both in X and in console, is set to the correct one! (en_US.UTF-8)

Am I making a newbie mistake somewhere?

Try:

. /etc/locale.conf; export LANG=en_US.UTF-8; exec nohup startx > /dev/null &vlock

https://wiki.archlinux.org/index.php/Be … ide_locale


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#8 2012-08-30 10:10:45

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

DSpider wrote:
gauthma wrote:
. /etc/locale.conf ; export LANG ; exec nohup startx > /dev/null &vlock 

And after doing that, the locale, both in X and in console, is set to the correct one! (en_US.UTF-8)

Am I making a newbie mistake somewhere?

Try:

. /etc/locale.conf; export LANG=en_US.UTF-8; exec nohup startx > /dev/null &vlock

https://wiki.archlinux.org/index.php/Be … ide_locale

Maybe I've not explained myself correctly: "And after doing that, the locale, both in X and in console, is set to the correct one! (en_US.UTF-8)"

My problem is that, *before* running that command, in console (no GUI), the locale is set to POSIX, for reasons thus far unknown to me...

Offline

#9 2012-08-30 11:47:53

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Cannot set locale (at first)

Read https://plus.google.com/114015603831160 … zKCcnTWDpa and try setting $HOME/.config/locale.conf.

Offline

#10 2012-08-30 12:00:28

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

I had already read that. Quoting (emphasis added):

Therefore, we have refactored our locale handling, and this is now available in [testing]. In this new scheme: /etc/locale.conf (or optionally rc.conf) sets the system locale, which applies to all daemons. This is also the fall-back locale which applies to user-sessions if nothing else is defined. Each user can now configure his/hers own locale in $HOME/.config/locale.conf, which applies only to their user session.

So $HOME/.config/locale.conf should not be needed in my case...

Offline

#11 2012-08-30 12:41:41

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Cannot set locale (at first)

Hmmmm:

$ cat /etc/locale.conf
LANG=en_US.UTF-8
$ cat .config/locale.conf
#LANG="pl_PL.UTF-8"
$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE=C
LC_MONETARY="C"
LC_MESSAGES=C
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

If I set $HOME/.config/locale.conf (uncomment LANG="pl_PL.UTF-8") things are working as expected, otherwise I get only the default C locales.

Last edited by karol (2012-08-30 12:42:04)

Offline

#12 2012-08-30 12:54:00

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

bug?

Offline

#13 2012-08-30 12:55:09

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [Solved] Cannot set locale (at first)

What if you delete/move/rename "~/.config/locale.conf" since you're not using it anyway (it's commented out) ?


Because I think it may have priority (even if it's blank).


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#14 2012-08-30 14:52:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Cannot set locale (at first)

DSpider wrote:

What if you delete/move/rename "~/.config/locale.conf" since you're not using it anyway (it's commented out) ?


Because I think it may have priority (even if it's blank).

You're right: if ~/.config/locale.conf exists but is "unset", locales defaults to 'C' (not sure why it's POSIX for OP; I don't use systemd)
If ~/.config/locale.conf doesn't exist, locales are set to what's in /etc/locale.conf - en_US.UTF-8 in my case.

Offline

#15 2012-08-30 15:55:38

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: [Solved] Cannot set locale (at first)

karol wrote:
DSpider wrote:

What if you delete/move/rename "~/.config/locale.conf" since you're not using it anyway (it's commented out) ?


Because I think it may have priority (even if it's blank).

You're right: if ~/.config/locale.conf exists but is "unset", locales defaults to 'C' (not sure why it's POSIX for OP; I don't use systemd)
If ~/.config/locale.conf doesn't exist, locales are set to what's in /etc/locale.conf - en_US.UTF-8 in my case.

FWIW, this is intentional. Maybe some more/better documentation is needed...

Offline

#16 2012-08-30 20:17:15

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

FYI, I do *not* have the file ~/.config/locale.conf

Offline

#17 2012-08-31 08:59:30

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 214

Re: [Solved] Cannot set locale (at first)

I think I have the same problem and I am not using testing (locale.sh is owned by filesystem 2012.8-1). After the last update the locale is always set to "C" no matter what I put in /etc/locale.conf. And I do not have ~/.config/locale.conf as well.

Offline

#18 2012-08-31 09:13:43

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [Solved] Cannot set locale (at first)

$ cat /etc/locale.conf
LANG=en_US.UTF-8

Do you get the same?


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#19 2012-08-31 09:44:44

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 214

Re: [Solved] Cannot set locale (at first)

DSpider wrote:
$ cat /etc/locale.conf
LANG=en_US.UTF-8

Do you get the same?

Oh, silly me. I have moved the configuration from rc.conf to the various new conf files and I have used LOCALE=... instead of LANG=.... Seems to be working ok now. Sorry for polluting the thread.

Offline

#20 2012-08-31 11:13:07

immortal_cro
Member
From: Koprivnica, Croatia
Registered: 2008-05-29
Posts: 3

Re: [Solved] Cannot set locale (at first)

Is your /etc/locale.conf readable by group and others (644)?


Keyboard error or no keyboard present
Press F1 to continue, DEL to enter SETUP

Offline

#21 2012-08-31 11:24:07

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] Cannot set locale (at first)

immortal_cro wrote:

Is your /etc/locale.conf readable by group and others (644)?

Yes.

Offline

#22 2012-08-31 12:03:10

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [Solved] Cannot set locale (at first)

Just a 2 cent coin from me -- maybe it helps someone...

After the filesystem upgrade, the /etc/profile.d/locale.sh file disappeared from my hdd (nothing fishy here: sometimes odd things happen and it's enough to re-run update to fix them). Before I realized that, I lost my default locales (en_US.UTF-8) and after issuing 'locale', I got the same output as the OP ("POSIX" from top to bottom). I was trying to use $HOME/.config/locale.conf file, but nothing expected ever happened, and the only way to make things work my way was to export LANG="en_US.UTF-8" in good old $HOME/.profile. When I eventually updated the filesystem correctly and /etc/profile.d/locale.sh was brought back, I realized that $HOME/.config/locale.conf won't work without it as this is where the relevant variable is set:

if [ -n "$XDG_CONFIG_HOME" ] && [ -r "$XDG_CONFIG_HOME/locale.conf" ]; then
  . "$XDG_CONFIG_HOME/locale.conf"
elif [ -n $HOME ] && [ -r $HOME/.config/locale.conf ]; then
  . "$HOME/.config/locale.conf"
elif [ -r /etc/locale.conf ]; then
  . /etc/locale.conf
elif [ -r /etc/rc.conf ]; then
  LANG=$(. /etc/rc.conf 2>/dev/null; echo "$LOCALE")
fi

Ergo: if your system hasn't been informed to use $HOME/.config/locale.conf anywhere in a system-wide context, the local file won't work. Simple and logical.

Last edited by bohoomil (2012-08-31 13:04:37)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#23 2012-08-31 12:43:36

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,393

Re: [Solved] Cannot set locale (at first)

After the latest update all is set to LANG=C to me too, but worked fine before, and i've had a pure systemd when it was working.
I have /etc/locale.conf with my locales set right and i have /etc/profile.d/locale.sh too.

# cat /etc/locale.conf
LOCALE="it_IT.UTF-8"
LC_COLLATE=C

# cat /etc/environment
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
QT_GRAPHICSSYSTEM=raster
LANG="it_IT.utf8"
LC_COLLATE=C

# ls ~/.config/locale.conf
ls: cannot access /home/koko/.config/locale.conf: No such file or directory

# file /etc/profile.d/locale.sh
/etc/profile.d/locale.sh: POSIX shell script, ASCII text executable

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

# pacman -Q|grep systemd
systemd 189-3
systemd-arch-units 20120704-5
systemd-sysvcompat 189-3
systemd-sysvinit 2.88-5
systemd-ui-git 20120828-1

Last edited by kokoko3k (2012-08-31 12:48:43)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#24 2012-08-31 12:53:53

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [Solved] Cannot set locale (at first)

kokoko3k, would you mind checking out if setting your local $HOME/.config/locale.conf with the content from your /etc/environment, i.e.

LANG="it_IT.utf8"
LC_COLLATE=C

works in your case at all?


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#25 2012-08-31 12:55:45

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,393

Re: [Solved] Cannot set locale (at first)

I was just to write it.
Yes, it works that way, but something has changed since the last upgrade because it worked with LOCALE=

Thanks!


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB