Index
»
System Administration
»
[SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Pages:
1
[SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
I'm using an Arch Linux environment where I'm testing the usage of "pacstrap". When I run:
after the installation of packages, I get as output:
<SNIP>
:: Running post-transaction hooks...
( 1/12) Creating system user accounts...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
( 2/12) Updating journal message catalog...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
( 3/12) Reloading system manager configuration...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Skipped: Running in chroot.
( 4/12) Updating udev hardware database...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
( 5/12) Applying kernel sysctl settings...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Skipped: Running in chroot.
( 6/12) Creating temporary files...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
( 7/12) Reloading device manager configuration...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Skipped: Running in chroot.
( 8/12) Arming ConditionNeedsUpdate...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
( 9/12) Rebuilding certificate stores...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
(10/12) Reloading system bus configuration...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Skipped: Running in chroot.
(11/12) Add Athena specific config
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
I guess it is considering "LC_ALL" variable from the host and not the one from the mount point (?).
The "/etc/locale.conf" of the Arch host is:
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
While "/etc/locale.gen" of the host contains:
"locale -a" output from the host:
C
C.utf8
en_US.utf8
POSIX
How can I solve the warning "/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)" in the mount point before running "pacstrap /mnt base"?
If I run "sudo locale-gen" on the Arch host, it does not solve the warning. I can "arch-chroot" inside "/mnt" and try to run "locale-gen" but if I do that BEFORE running "pacstrap /mnt base" command, I don't have "locale-gen" command available.
Last edited by D3vil0p3r (2023-10-06 15:06:34)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Why is LC_ALL set in /etc/locale.conf?
Edit:
Also LANGUAGE is wrong see
Locale#LANGUAGE:_fallback_locales
.
Last edited by loqs (2023-10-06 10:27:41)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
loqs wrote:
Why is LC_ALL set in /etc/locale.conf?
Because if I don't set it there, I get that warning message as:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
I know that ArchWiki says:
LC_ALL is the only LC_* variable which cannot be set in locale.conf files
ref:
https://wiki.archlinux.org/title/locale … leshooting
So it means that I should not set "LC_ALL" anywhere in a production environment? If so, how can I avoid that warning with (unset)?
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
If I set only that variable in /etc/locale.conf and keeping only "en_US.UTF-8 UTF-8" in /etc/locale.gen, in the mount point I get:
(11/12) Warn about old perl modules
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Last edited by D3vil0p3r (2023-10-06 12:14:08)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
loqs wrote:
If you replace en_US.UTF-8 UTF-8 with en_US.utf8 is there any chance?
So, you mean to remove the charset part of "en_US.UTF-8 UTF-8" (that is the last UTF-8) and remove the dash in "en_US.UTF-8" in /etc/locale.gen?
If I try to do this in the host and run"sudo locale-gen", I get an error:
Generating locales...
error: Bad entry 'en_US.UTF-8 '
Generation complete.
if I keep the dash or:
Generating locales...
error: Bad entry 'en_US.UTF8 '
Generation complete.
if I don't keep it.
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Scimmia wrote:
They meant in locale.conf, not locale.gen.
locale.conf was already as:
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=
Last edited by D3vil0p3r (2023-10-06 12:35:53)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
I can solve those errors/warnings by entering the mount point by "arch-chroot" and running "locale-gen". But "locale-gen" should be a binary obtained from "glibc" that is inside "base" metapackage, but if I install "base" by pacstrap, it generates the output on the first post and I cannot run "locale-gen" before "pacstrap /mnt base" because at that time "locale-gen" command does not exist. I hope the scenario is clear.
Last edited by D3vil0p3r (2023-10-06 12:40:54)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Scimmia wrote:
Are you giving us some output from outside the chroot and some from inside?
Here an example according to the changes done during this discussion. I have a fresh Arch Linux environment with "/etc/locale.conf":
and "/etc/locale.gen":
I run "sudo pacstrap /mnt /base" and I get the output of the install of packages of base metapackage and after the install, during the post transactional hooks I get:
(11/12) Warn about old perl modules
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
If I enter by "sudo arch-chroot /mnt" by making its /etc/locale.conf and .gen as the ones of the host (so, with the en_US strings), and then I run "locale-gen" in this chroot, I fix. The problem is that I should fix "before" I run "pacstrap /mnt base" because I would like to manage this warning above produced by running "sudo pacstrap /mnt base".
Last edited by D3vil0p3r (2023-10-06 12:52:36)
Re: [SOLVED] setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
$ sudo pacstrap /mnt /base
==> Creating install root at /mnt
==> Installing packages to /mnt
:: Synchronizing package databases...
core is up to date
extra is up to date
error: database not found: base
==> ERROR: Failed to install packages to new root
Specify LANG=C.UTF8 to use a locale that is prebuilt in glibc, also I had to add perl as it is not pulled in by base:
sudo LANG=C.UTF-8 pacstrap /mnt base perl
or install glibc-locales so all the locales are prebuilt
sudo LANG=C.UTF-8 pacstrap /mnt base perl glibc-locales
Note warnings are not errors.
Edit:
Did the warnings you posted result in any issues in the resulting install?
Last edited by loqs (2023-10-06 13:10:20)