Perl Setting Locale Failed

Trying to diagnose this issue but I can’t figure it out, even after reading the numerous other topics of the same problem.

The problem:
Each time a perl application is used I get this warning;
perl -e 'print "Hi!\n";'

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LC_IDENTIFICATION = "en_US.UTF-8",
        LC_MEASUREMENT = "en_US.UTF-8",
        LC_MONETARY = "en_US.UTF-8",
        LC_NUMERIC = "en_US.UTF-8",
        LC_NAME = "en_US.UTF-8",
        LC_TIME = "en_US.UTF-8",
        LC_CTYPE = "en_US.UTF-8",
        LC_TELEPHONE = "en_US.UTF-8",
        LC_ADDRESS = "en_US.UTF-8",
        LC_PAPER = "en_us.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Hi!

As per https://wiki.archlinux.org/title/Locale#Set_LC_CTYPE I added LC_CTYPE to locale.conf and deleted ~/.config/plasma-localerc in an attempt to fix this, with no success.

Below is the output of all suggested commands I found in other topics to try and diagnose/fix the issue.
inxi -S

System:
  Host: endeavour Kernel: 6.8.9-arch1-1 arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.0.4 Distro: EndeavourOS

cat ~/.config/plasma-localerc

[Formats]
LANG=en_US.UTF-8

cat /etc/locale.conf

LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_us.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8

cat /etc/default/locale

LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8

Commented out from /etc/locale.gen:

###
#
# Locales enabled by Calamares
#en_US.UTF-8 UTF-8
#nl_BE.UTF-8 UTF-8

grep -v '^#' /etc/locale.gen

   

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
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_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

locale -a

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_COLLATE to default locale: No such file or directory
C
C.utf8
POSIX

localectl status

System Locale: LANG=en_US.UTF-8
               LC_PAPER=en_us.UTF-8
    VC Keymap: be-latin1
   X11 Layout: be
  X11 Variant: nodeadkeys

sudo locale-gen

[sudo] password for franky: 
Generating locales...
Generation complete.

Fixed my problem:

As per instructions in another thread, I commented out this from /etc/locale.gen:

###
#
# Locales enabled by Calamares
#en_US.UTF-8 UTF-8
#nl_BE.UTF-8 UTF-8

But the problem persisted and I (foolishly) assumed having them commented out was the correct configuration for /etc/locale.gen

What solved it for me was uncommenting them once more, and run locale-gen again. then it would generate the locales and fix my problem.

locale -a

C
C.utf8
en_US.utf8
nl_BE.utf8
POSIX

Alternatively, installing glibc-locales would also fix the problem, as this package contains already generated locales.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.