Problems with locales

Hello,
I keep having problems with the locale settings, I can’t get it right.

locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
warning: The LOCPATH variable is set to "/home/<user>/.locale"
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=nl_NL.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

The directory /home//.locale does not exist, even when I create the directory and do the locale instruction again, I get the same output as above.
What is wrong and how do I fix it?
Maybe somebody can tell me what I need to do after a clean install to get the system language in en_US.UTF-8 and all other variables in nl_NL.UTF-8.
Or is this something which is not even possible?

Operating System: Fedora Linux 43
KDE Plasma Version: 6.5.1
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0
Kernel Version: 6.17.5-300.fc43.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics
Memory: 16 GiB of RAM (14,8 GiB usable)
Graphics Processor 1: AMD Radeon 680M
Graphics Processor 2: NVIDIA GeForce RTX 3060 Laptop GPU
Manufacturer: LENOVO
Product Name: 82RG
System Version: Legion 5 Pro 16ARH7H
inxi -b
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LC_CTYPE = (unset),
        LC_NUMERIC = "nl_NL.UTF-8",
        LC_COLLATE = (unset),
        LC_TIME = "nl_NL.UTF-8",
        LC_MESSAGES = (unset),
        LC_MONETARY = "nl_NL.UTF-8",
        LC_ADDRESS = "nl_NL.UTF-8",
        LC_IDENTIFICATION = (unset),
        LC_MEASUREMENT = "nl_NL.UTF-8",
        LC_PAPER = "nl_NL.UTF-8",
        LC_TELEPHONE = "nl_NL.UTF-8",
        LC_NAME = "nl_NL.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
System:
  Host: fedora Kernel: 6.17.5-300.fc43.x86_64 arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.5.1 Distro: Fedora Linux 43 (KDE Plasma Desktop
    Edition)
Machine:
  Type: Laptop System: LENOVO product: 82RG v: Legion 5 Pro 16ARH7H
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0T76461 WIN
    serial: <superuser required> UEFI: LENOVO v: JUCN68WW date: 12/05/2024
Battery:
  ID-1: BAT0 charge: 56.9 Wh (76%) condition: 74.9/80 Wh (93.7%) volts: 15.56
    min: 15.44
CPU:
  Info: 8-core AMD Ryzen 7 6800H with Radeon Graphics [MT MCP] speed (MHz):
    avg: 1096 min/max: 404/4787
Graphics:
  Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] driver: nvidia
    v: 580.95.05
  Device-2: Advanced Micro Devices [AMD/ATI] Rembrandt [Radeon 680M]
    driver: amdgpu v: kernel
  Display: wayland server: Xwayland v: 24.1.9 compositor: kwin_wayland
    driver: gpu: amdgpu,nv_platform,nvidia,nvidia-nvswitch resolution:
    1: 2560x1440~144Hz 2: 2560x1600~165Hz
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 25.2.5 renderer: AMD
    Radeon 680M (radeonsi rembrandt LLVM 21.1.2 DRM 3.64
    6.17.5-300.fc43.x86_64)
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi
    wl: wayland-info x11: xdriinfo, xdpyinfo, xprop, xrandr
Network:
  Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    driver: mt7921e
  Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    driver: r8169
Drives:
  Local Storage: total: 953.87 GiB used: 658.14 GiB (69.0%)
Info:
  Memory: total: 16 GiB note: est. available: 14.8 GiB used: 5.72 GiB (38.6%)
  Processes: 426 Uptime: 1h 22m Shell: Bash inxi: 3.3.39

Thanks.

unset the LOCPATH variable and try locale again.

1 Like

I did the unset LOCPATH command and now I get this:

locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=nl_NL.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

No more errors.
I just wonder why was it complaining about the locpath, I did not set it, it was just there.

What is the correct way to follow when you install a distro to avoid these errors? Can I set the locales using the KDE System-Settings (Region & Language) or do I need to use the terminal? If I need to use the terminal how do I set the locale settings?
This is something which I never got right when installing a distro. I sure hope that with your simple command.
Thank you very much for your help.

It doesn’t exist on my KDE system, so if you’re using Gnome can you find any trace of it in any of your .rc files or any of the scripts which run upon startup or the login for this user?

see man 7 locale for a description of that environment variable is used for, but for eas of reference, it states

ENVIRONMENT
       The following environment variable is used by newlocale(3) and setlocale(3), and thus affects all unprivileged localized programs:

       LOCPATH
              A list of pathnames, separated by colons (':'), that should be used to find locale data.  If this variable is set, only the individual compiled locale data files from LOCPATH and the system default locale data  path  are  used;
              any  available  locale archives are not used (see localedef(1)).  The individual compiled locale data files are searched for under subdirectories which depend on the currently used locale.  For example, when en_GB.UTF-8 is used
              for a category, the following subdirectories are searched for, in this order: en_GB.UTF-8, en_GB.utf8, en_GB, en.UTF-8, en.utf8, and en.

Something has set it at some point, but on your system, I have no idea what.

No, I don’t use Gnome but KDE.
I have just, as a test, installed the KDE edition onto an older laptop which I gave a new partition table and new partitions before installing and I get the same error there straight after installing. No changes made at all.
unset LOCPATH does clear it but after a reboot I see the same errors again.

Something is setting it then, at start up. Time for a bit of ripgrep action I’d say, or just sack it off and unset it in your shell’s login script.

I created a login script, let’s see how this works.
Thanks again.

Did you install any aditional apps after the fresh install?

I have not seen that variable set on any of my systems. I’m also a KDE user.

Do you see LOCPATH in any of the files in /etc/profile?
Do you see LOCPATH in any files in .local/… or .config/…?

Hello Barry, thanks for your answer.

Well, I did install my normal flathub flatpaks, the ones I always install because I want to use them.
Plus I installed some of the top programs (htop, btop, iotop and nvtop), inxi and Timeshift.
The top programs all work without giving error messages, Timeshift creates a daily backup so no problem there, only inxi, although I get an output, gives me some extra messages:

inxi
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LC_CTYPE = (unset),
        LC_NUMERIC = "nl_NL.UTF-8",
        LC_COLLATE = (unset),
        LC_TIME = "nl_NL.UTF-8",
        LC_MESSAGES = (unset),
        LC_MONETARY = "nl_NL.UTF-8",
        LC_ADDRESS = "nl_NL.UTF-8",
        LC_IDENTIFICATION = (unset),
        LC_MEASUREMENT = "nl_NL.UTF-8",
        LC_PAPER = "nl_NL.UTF-8",
        LC_TELEPHONE = "nl_NL.UTF-8",
        LC_NAME = "nl_NL.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
CPU: 8-core AMD Ryzen 7 6800H with Radeon Graphics (-MT MCP-)
speed/min/max: 1096/404/4787 MHz Kernel: 6.17.8-300.fc43.x86_64 x86_64 Up: 48m
Mem: 5.42/14.8 GiB (36.6%) Storage: 953.87 GiB (72.5% used) Procs: 408
Shell: Bash inxi: 3.3.39

You ask for the text LOCPATH in a couple of folders, I did check some files but no LOCPATH there. There are however many more files. Can you be a bit more specific about which ones I should check cause there are a lot of them.

When you install Fedora KDE what do you do with the locales? Do you change some settings, do you add some, or do you do nothing at all?
Can you give me some of your files where locale settings are stored so I can compare them with mine?
I have no idea where to search or what to do, I sure would like to get rid of these errors. This has lasted way too long already.

I do not know specifically where this rogue setting will be stored.

You can use ripgrep to search all the files in a folder tree for a string.
Something like this I think:

sudo dnf install ripgrep
rg LOCPATH .local .config
sudo rg LOCPATH /etc

Given you setup the old machine to test for this problem you could reinstall and this time check that LOCPATH status after the KDE install.
Then check after each app is installed.

I’m guessing you will find LOCPATH is not set on a uncustomised plasma insatall. THen after one of the apps you install LOCPATH will show up.
You would need to reboot after each install of an app to check that login is still lacking LOCPATH.

1 Like

I decided to do just what you write here and while doing so I found the location where the LOCPATH is set. Well, at least one location, no idea if there are more but I doubt that.
I found it in my .bashrc file. At the end of that file I saw this:

# Added by konsave-gui installer
export PATH="$HOME/.local/bin:$PATH"
export LOCPATH=$HOME/.locale

konsave is a program which can be found on github. It is used to save the KDE settings to a safe place from where you can always restore them without having to adjust a lot of settings manually. I have no idea why this program uses this location, but this is what I found.

I am now busy setting up the new install, so I have something to do this evening. :smiley:

Thank you all for your help. I now really hope I won’t get this trouble again.

It is usually a bad idea to set PATH or similar in .bashrc, it is safer to set in .bash_profile so that you can override at the command line for any sub shells.

Well, I did not know that but it was not me who did it. It happened apparently when Konsave was installed and I did not see the program added these lines to my .bashrc, so I didn’t know.

Thanks for your help Barry, it is all working now.

If that’s what konsave did that I would consider that as a bug.
But there are a lot of people insist that settng this sort of thing in .bashrc is a okay. A bug report may not get a fix.

I emptied the Solution thickbox because it is not okay yet. I now have problems with Thunderbird not making connection to the Gmail servers. When I start it in the terminal I get this:

flatpak run org.mozilla.Thunderbird
[2] Sandbox: CanCreateUserNamespace() clone() failure: EPERM
[2, Main Thread] WARNING: Locale not supported by C library.
        Using the fallback 'C' locale.: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:201

(thunderbird-esr:2): Gtk-WARNING **: 12:41:59.959: Locale not supported by C library.
        Using the fallback 'C' locale.

What can/must I do to solve this?
Thanks.

Are you sure that’s a Locale problem? The “locale not supported” message is a warning and the actual error seems to be an EPERM (which I assume is “PERMission”)

If you revert your changes does that correct this Thunderbird issue?

1 Like

What does the locale command report?

Have you run a flatpak update after making the locale changes?

This the output of locale:

locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=nl_NL.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
localectl status
System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: us
    X11 Model: pc105

But as @anothermindbomb also wrote, it is probably not the locale settings which cause the error but EPERM:

flatpak run org.mozilla.Thunderbird
[2] Sandbox: CanCreateUserNamespace() clone() failure: EPERM
[2, Main Thread] WARNING: Locale not supported by C library.
        Using the fallback 'C' locale.: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:201

(thunderbird-esr:2): Gtk-WARNING **: 14:03:53.439: Locale not supported by C library.
        Using the fallback 'C' locale.
[Parent 2, Main Thread] WARNING: Running in confined mode, using Portal notifications. Some features and hints won't be supported: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:201

(org.mozilla.Thunderbird:2): libnotify-WARNING **: 14:03:54.803: Running in confined mode, using Portal notifications. Some features and hints won't be supported

I have done a few rollbacks to the last 3 versions for Thunderbird but that didn’t help.

Hi Joe, I just did it now and there was nothing to update, so I am up to date.