exiftool generate perl error Setting locale failed Please check that your locale settings

launching exiftool this error appear

perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US",
        LC_ALL = (unset),
        LC_MEASUREMENT = "it_IT.UTF-8",
        LC_MONETARY = "it_IT.UTF-8",
        LC_COLLATE = "it_IT.UTF-8",
        LC_CTYPE = "en_US.UTF-8",
        LC_TIME = "en_SE.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").



how can I get rid of it?
I searched in the web but the instructions gave me this error: locale-gen is not present

pla4-TW:~ # localedef -i en_US -f UTF-8 en_US.UTF-8pla4-TW:~ # export LANGUAGE=en_US.UTF-8
pla4-TW:~ # export LANG=en_US.UTF-8
pla4-TW:~ # export LC_ALL=en_US.UTF-8
pla4-TW:~ # locale-gen en_US.UTF-8
If 'locale-gen' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf locale-gen
pla4-TW:~ # locale-gen "en_US.UTF-8"
If 'locale-gen' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf locale-gen
pla4-TW:~ # localegen "en_US.UTF-8"
If 'localegen' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf localegen
pla4-TW:~ # /usr/bin/locale-gen "en_US.UTF-8"
-bash: /usr/bin/locale-gen: No such file or directory
pla4-TW:~ # locale
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=en_US.UTF-8
pla4-TW:~ # 




Hi
The locale-gen is part of bash-completions (/usr/share/bash-completion/completions/locale-gen)…

manythanks malcolm, I tried to find in yast>software managementa bash-completion,
|bash-completion - Programmable Completion for Bash
|
|

|Version:
|
|2.7-4.6.1
|

and it is installed.
and looking into /usr/share/bash-completion/completions/
I cannot find local-gen, with local in the mane I can only find this:

file:///usr/share/bash-completion/completions/aclocalfile:///usr/share/bash-completion/completions/aclocal-1.10
file:///usr/share/bash-completion/completions/aclocal-1.11
file:///usr/share/bash-completion/completions/aclocal-1.12
file:///usr/share/bash-completion/completions/aclocal-1.13
file:///usr/share/bash-completion/completions/aclocal-1.14
file:///usr/share/bash-completion/completions/aclocal-1.15
file:///usr/share/bash-completion/completions/fallocate
file:///usr/share/bash-completion/completions/localectl

how can I solve to get rid of the problem?

if it can help in the past I asked the same problem and at that time was solved here:
https://forums.opensuse.org/showthread.php/542722-perl-warning-Setting-locale-failed
the solution was this:

…but your idea of alias triggered me that “en_SE.UTF-8” could be aliased to or copied from “en_US.UTF-8”,so I copied
“usr/lib/locale/en_US.utf8”
and
“usr/share/locale/en_US”
and renamed respectively
“usr/lib/locale/en_SE.utf8”
and
“usr/share/locale/en_SE”
rebooted, and it works!!!

I checked and and renamed respectively “usr/lib/locale/en_SE.utf8”
and
“usr/share/locale/en_SE”
are present
but it doesn’t works

Hi
Then is sounds like a bug…

On Tumbleweed I see;


find /usr/share/ -name locale-gen


/usr/share/bash-completion/completions/locale-gen

openSUSE:Submitting bug reports - openSUSE

It is just completion for command locale-gen. It is not the command itself. Existence of completion definition does not imply existence of command (this definition comes from upstream and everything in bash-completion is installed).

openSUSE:Submitting bug reports - openSUSE

Sorry, what exactly is a bug here?

so, why I haven’t locale-gen command?

I had the idea that your problem was a Perl message about your locale.
(I assume that it is the mix of Italian, Swedish and English variables that confuses Perl, but I do not know much about Perl).

Then you explained that you found “instructions on the web” without telling where, or what or anything except that these, for us mysterious, instructions told you to use the command locale-gen.

Then you show how you used that command and that bash told you it could find locale-gen nowhere. Then you tried that again and alas, bash can still not find locale-gen. You tried a third time, probably thinking that bash then by great magic can find locale-gen. but no, it didn’t.
Then you thought that maybe locale-gen was on /usr/bin and that maybe that wasn’t in your PATH variable, thus you tried to specify the full path to bash. It isn’t there :(.

After that the whole discussion deviated to the question why locale-gen isn’t on your 15.3 and if that is a bug or not. And then confusion about what the question was.

But I assume the question is still, what does Perl try to communicate and can that message be avoided by doing something about the locale variables. And probably in a way that that does not break the way they are used now (I assume that Italian, Swedish, US-English mix was created with a purpose).

yes, you are right, the question is still, what does Perl try to communicate and can that message be avoided by doing something about the locale variables.
and yes, italian becouse I’m in italy, US becouse I prefere US as system language and when my foreign friends or collegues use the pc is easier, and swedish english for the ISO date.
I didn’t know that this can confuse perl, also becouse the language mixing seems planned in linux and kde

Because locale-gen is used by Debian. If you want to generate your own locale, install glibc-i18ndata and use localedef command.

Perl says that one of locales does not exist, it is en_SE.UTF-8 in this case.

and can that message be avoided by doing something about the locale variables.
The question is where this locale name comes from.

I think I can explain this (more or less). It is used in

LC_TIME = "en_SE.UTF-8"

probably because the user wants the date expressed in ISO format. Since some level of KDE, it does not support ISO formatted dates. And since then people try all sorts of by-passes to this problem (which apparently is not addressed by KDE at all).

@pier_andreit.
I do not completely understand your explanation about your locale settings. I can understand that for system purposes you prefer Engish (in fact LANG=C) as I do. But for the normal users, I understand you prefer Italian (like I prefer Dutch), but that is for different users with different environments and not a mix.

E.g. on my system for root:

boven:~ # locale
LANG=POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
boven:~ #

and for one of the users:

henk@boven:~> locale
locale: Kan LC_ALL niet op de standaard taalregio instellen: Bestand of map bestaat niet
LANG=nl_NL.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="nl_NL.UTF-8"
LC_TIME=en_SE.UTF-8
LC_COLLATE="nl_NL.UTF-8"
LC_MONETARY="nl_NL.UTF-8"
LC_MESSAGES="nl_NL.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="nl_NL.UTF-8"
LC_ALL=
henk@boven:~> 

And yes, there is a warning there also. It is not just Perl that stumbles into the Swedish date representation. Thus, IMHO, you have to live with that warning, or have to live with the malformed date expression.

I showed already that it has repercussions in the locale statement. But I found more problems. User henk e.g. has problems showing file names containing Unicode characters outside the ASCII range. See these from the same directory /home/henk/test/unicode:

henk@boven:~/test/unicode> l
total 12
drwxr-xr-x 3 henk wij 4096 May 24  2021 ./
drwxr-xr-x 7 henk wij 4096 Jan  2 19:05 ../
-rw-r--r-- 1 henk wij    0 May  5  2020 alles goed?
-rw-r--r-- 1 henk wij    0 Jan 11  2016 hello
drwxr-xr-x 2 henk wij 4096 Mar 31  2014 ??????????????/
-rw-r--r-- 1 henk wij    0 Feb 22  2016 ???????
-rw-r--r-- 1 henk wij    0 Jan 11  2016 ??????????????
-rw-r--r-- 1 henk wij    0 Jan 11  2016 ????????????????????????
-rw-r--r-- 1 henk wij    0 Jun 20  2016 ????????????
-rw-r--r-- 1 henk wij    0 Jan 11  2016 ????????
-rw-r--r-- 1 henk wij    0 Jan 11  2016 ??????????????????
henk@boven:~/test/unicode
boven:/home/henk/test/unicode # l
total 12
drwxr-xr-x 3 henk wij 4096 May 24  2021 ./
drwxr-xr-x 7 henk wij 4096 Jan  2 19:05 ../
-rw-r--r-- 1 henk wij    0 May  5  2020 alles goed?
-rw-r--r-- 1 henk wij    0 Jan 11  2016 hello
drwxr-xr-x 2 henk wij 4096 Mar 31  2014 öäüßÖÄÜ/
-rw-r--r-- 1 henk wij    0 Feb 22  2016 Œé⁶
-rw-r--r-- 1 henk wij    0 Jan 11  2016 Χαίρετε
-rw-r--r-- 1 henk wij    0 Jan 11  2016 Здравствуйте
-rw-r--r-- 1 henk wij    0 Jun 20  2016 Лшадсщ
-rw-r--r-- 1 henk wij    0 Jan 11  2016 أهلا
-rw-r--r-- 1 henk wij    0 Jan 11  2016 नमस्ते
boven:/home/henk/test/unicode # 

yes, this is the why

for the normal user I prefere english becouse if a foreign collegue ask me, for example, how to show comments in libreoffice writer I can easily view in writer and tell him go to view>show comments, if menus was in italian I had to translate with probably errors, instead of reed only.

in case I diicide to live with warning I found a sort of workaround, if I send to file the command that call the script the warning isn’t reported, the script is like this

#!/bin/bash
exiftool -s -s  -ImageWidth "pla001(madrid).jpg"
........
exiftool -s -s  -ImageWidth "pla100(madrid).jpg"

but with many commands
so if I do this

./script > wi.txt

then I can use wi.txt file to copy the result instead of copying standard output from konsole

otherwise if I decide to live malformed date how can I solve?

There is no “the normal user”, there are only normal users (meaning: not root). And of course each one of them can decide for himself what language he wants to use. But for root, I would never deviate from the default.

Hi, it seems solved,
from here

First list the current locale settings for the user.

$ locale
LANG=en_HK.UTF-8
LANGUAGE=en_HK:en
LC_CTYPE="en_HK.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_HK.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_HK.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=

Then generate these locales one by one.

$ sudo locale-gen "en_HK.UTF-8"
Generating locales...
 en_HK.UTF-8... up-to-date
Generation complete.

but the command is not good for opensuse so I found the command from arvidjaar and here

It seems

sudo localedef -i en_SE en_SE

is the right command. I think I’ll have to log out for this to work…

With the last command all accented characters were replaced with question marks in Konsole. The following command does work:

sudo localedef -i en_SE -f UTF-8 en_SE

so I did

pla@pla4-TW:~> locale
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_SE.UTF-8
LC_COLLATE=it_IT.UTF-8
LC_MONETARY=it_IT.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=it_IT.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
pla@pla4-TW:~> sudo localedef -i en_SE -f UTF-8 en_SE
[sudo] password for root: 
pla@pla4-TW:~>

and without logout and login the perl error generated by exiftool disappeared