Locale: Cannot set LC_ALL to default locale

Since recently I am getting this kind of errors when trying to run man or locale:

man lsof                                                                       I
man: can't set the locale; make sure $LC_* and $LANG are correct
locale                                                                         I
locale: Cannot set LC_ALL to default locale: No such file or directory

Can’t figure out why I am suddenly having these problems and which is the best way to fix them. For bash I added

export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"

to my ~/.bashrc and after the regeneration of locale the problem seems to be “fixed” for this shell. Should I do the same for all the other shells or is there a better way to deal with it?

The output of locale and locale -a in case it is needed (in zsh shell):

locale                                                                         I
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
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_150.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
locale -a                                                                      I
C
en_US.utf8
POSIX

And /etc/locale.conf:

LANG=en_US.UTF-8

The system is running vanilla Arch with Plasma, if that matters.

edit: looks like the issue is with my Plasma configuration, because I am not getting these errors in dwm or a tty.

Well, I think it is solved. For some reason Measurement Units set to metric in Plasma settings (Regional Settings -> Formats) was breaking things. After reverting everything back to the defaults it seems to be normal again :expressionless:

edit: I moved this to the Plasma section, but the actual problem was in LC_MEASUREMENT set to “en_150.UTF-8” (which corresponds to Europe - English in Plasma settings), for which no default locale could be found. Setting Measurement Units to an existing locale (e.g. France, Poland, etc.) uncommenting the corresponsing entry in /etc/locale.gen and running sudo locale-gen afterwards works as well, without having to have only default values set.

3 Likes