"Failed to set locale" warnings


#1

Recently when starting bash, I’ve started seeing error messages like this:

bash: warning: setlocale: LC_ALL: cannot change locale (en.UTF-8): No such file or directory

The lumina wm.log has something similar:
Warning: Failed to set locale, reverting to "C"

Running locale shows:

$ locale
LANG=en.UTF-8
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=en.UTF-8

which is not one of the installed locales:

$ locale -a | grep en.UTF-8
$ 

I’ve grep’ed a bit, but can’t find where this getting set. Has anyone run into this issue before?


#2

Are you using TrueOS with Lumina?.. Linux with Lumina, or TrueOS with a different DE?.. What is the output if you type in about in a terminal?


#3

Sorry, yes, this is TrueOS with Lumina:

===================
General information
===================

boot environment now (N) … 12.0-CURRENT-up-20170806_151106 NR 2017-08-06
       after restart (R) … 12.0-CURRENT-up-20170806_151106 NR 2017-08-06
boot loader …………………………………… BSD
            type ……………………… EFI
CPU ………………………………………………………… Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz
    number of cores ……………… 8
host ……………………………………………………… fluffy.tuffli.net
memory ………………………………………………… 16384 MB available, 10338 MB free
OS git branch ……………………………………………………………………………………… trueos-stable
OS git revision ………………………………………………………………………………… ac2f0aa3b
OS kernel build time ………………………………………………………… Wed 2017 Jun 21 01:09:23 UTC
OS kernel identity …………………………………………… (uname -i) GENERIC
OS platform (architecture) ……………………… (uname -m) amd64
OS release level ………………………………………………… (uname -r) 12.0-CURRENT
OS version and patch level …… (freebsd-version) 12.0-CURRENT
TrueOS package set ………………… STABLE
TrueOS version …………………………… TrueOS-Desktop-201706210948
uptime ………………………………………………… 7:40
user  …………………………………………………… ctuffli

More (TrueOS Desktop):

    desktop environment …… Lumina
    sound card driver ………… pcm0: <NVIDIA GT21x (HDMI/DP 8ch)> (play) default
    wireless driver ……………… 
    X11 drivers ………………………… nvidia_drv.so

#4

Which shell are you using? The default CSH or bash?


#5
$ echo $SHELL
/usr/local/bin/bash
$ /usr/local/bin/bash --version
GNU bash, version 4.4.12(2)-release (amd64-portbld-freebsd12.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

#6

Changing the shell to /bin/csh makes this go away. Is it possible this happens because of /etc/profile?


#7

That would be my guess, yes


#8

The bash error seemed weird, since we use csh. I thought maybe he was on Linux and just using the Lumina DE.


#9

By chance, I’ve discovered this is related to auto-login. The locale seems to be set correct if you either a) disable auto-login and always login manually or b) leave auto-login enabled, but always logout and back in manually.


#10

If locale is really missing, create it, using:

https://www.freebsd.org/cgi/man.cgi?query=localedef&manpath=FreeBSD+11.1-RELEASE+and+Ports


#11

It wasn’t really missing. He changed his shell from default to bash, once he switched it back to the default shell and everything worked as expected.


#12

I misread the original poster’s grep as being correct.
But it wasn’t. My fault.


#13