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.