Localedef Runs But Doesn’t Change Locale

Home » CentOS » Localedef Runs But Doesn’t Change Locale
CentOS No Comments

Hello everyone,

When I run the command localedef -c -i en_GB -f UTF-8 en_GB.utf-8 the command runs with no errors but running locale still shows:

LANG=en_US.UTF-8
LANGUAGE=en_US
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
I rebooted the machine just in case, that didn’t help

Running locale -a shows many options including en_GB and en_GB.utf-8

The only way that I have been able to change the locale is by editing
/etc/sysconfig/i18n. If I change that and then reboot it changes the locale. However what confuses me about this is that I can only change to a new locale, I can’t seem to go back to a previous locale. For example, I started with en_US, changed it to en_GB which worked. Then I tried to change it back to en_US and nothing happened. After that I decided to try to see if it was only failing with en_US
or if it would always fail. So I tried changing from en_GB to en_NZ
which worked. Then I tried to go from en_NZ to en_US which failed. At this point I don’t care as much about getting the right locale. I just want to know why it will change to something new, but not change back to a previous locale.

I have tested this on 6.4, 6.5, and 6.8 and get the same results. First I was running it on a VM using QEMU and VMM but I tried it on a physical machine and nothing changed. All of these were fresh installs, the first thing I did after completing the install was try to change the locale.

Any advice or explanation is appreciated, thanks in advance.

Zach