Why is almost every program complaining about my locale?

You're missing a file which would be used to default the locale in the absence of $LANG or $LC_ALL (or all of the more specific $LC_whatever) being set.

On older glibc, it's /usr/lib/locale/locale-archive. Because GNU/Linux is chaotic, you should use strace to determine which files are expected in the particular versions in use on your machine:

strace -e file locale
execve("/usr/bin/locale", ["locale"], [/* 36 vars */]) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libc.so.6", O_RDONLY)        = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3

----------------------Comments added 1 day later:

ltrace -S should be okay, since it shows syscalls.

Otherwise, "ltrace" is not very helpful (i.e. it's counterproductive versus strace), because it only shows the uppermost calls. Those are obvious (setlocale(3)), whereas the real problem happens within libc.

It sounds like you have the raw locale data installed, since en_US.UTF-8 works.

If so, then something like this should fix your problem, setting a system-wide default:

localedef -f UTF-8 -i en_US en_US.UTF-8

I had the same issue after setting up /etc/locale.conf just today (relating to the recent changes to /etc/rc.conf. In my case, it turned out that the locales were not installed.

Check /etc/locale.gen. All the locales which your environment variables reference must be activated (i.e. not commented out) in there. After having made your changes, run sudo locale-gen to install the selected locales.


Following this link solves my problem :

sudo localectl set-locale LANG=en_CA.UTF-8
# or change to en_US.UTF-8 depends on your locale-gen

it generates a file /etc/locale.conf that fixes this issue