/etc/locale.conf Is Ignored

Home » CentOS » /etc/locale.conf Is Ignored
CentOS 2 Comments

It seems that /etc/locale.conf is ignored in CentOS 7.

As a traditionalist who prefers things sorted lexicographically rather than indiscriminately with case ignored and dates to be displayed in the form “Sep 11 2008”, I have always added lines to this file:

$ cat /etc/locale.conf
LANG=”en_US.UTF-8″
# Fix collating sequence for sort and ls
export LC_COLLATE=C
# Fix time format in ls -l to Sep 11 2008
export LC_TIME=C

and it’s always worked – in UNIX, all Fedora’s, CentOS 6 (I think). Now, in a fresh installation of CentOS 7 (virtual, kvm) these exported environment variables are nowhere to be seen.

If I manually type export LC_COLLATE=C in an xterm, sorting works
“properly” again.

Why is /etc/locale.conf ignored in CentOS 7 – and not in Fedora 20?

While it shouldn’t matter, I’ll mention that I’m running Xfce4 with mostly xterm windows – where the LC_COLLATE and LC_TIME variables are absent from `env`. However, if I revert to a non-X console (CTL-ALT-F2), these variables are present.

So, /etc/locale.conf isn’t totally ignored. Perhaps xterm, or Xfce4, or that whatever it is awful undocumented GUI thing that starts X, has simply forgotten the concept of “export”.

2 thoughts on - /etc/locale.conf Is Ignored

  • Well, I have isolated the problem to that “awful undocumented GUI thing that starts X” – namely, gdm!

    I first switched to multi-user.target, which provides the old familiar UNIXy login: and ran ‘startxfce4’. The `env` contained both LC_COLLATE=C and LC_TIME=C.

    Then I switched back to graphical.target, but also did yum install lightdm, systemctl disable gdm, systemctl enable lightdm, and after rebooting with a graphical login, found that my two environment variables were present in the enviroment.

    So gdm, once again, demonstrates a flagrant disregard of longstanding standards and conventions. Ugh!