I get the error as show in figure due to the default locale setting in Yocto is POSIX. Now my problem is that I have no idea how to change the locale setting to en_US.utf-8 in Yocto
-
Which Operating system do you use? – Mahesh Kumar Kodanda Feb 07 '17 at 16:08
-
Please share more details, like the full and exact error message and your debugging attempts – Nico Haase Jan 18 '21 at 21:31
2 Answers
I am also using yocto. I got an error like the following when trying to run a script on python3.
Traceback (most recent call last): ... RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either switch to Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.
To solve it, first I had to enable UTF-8 in your local.conf
GLIBC_GENERATE_LOCALES = "en_GB.UTF-8 en_US.UTF-8"
then, when running locale -a on the target I got something like.
C
en_GB
en_US
POSIX
To make sure the locals are UTF-8, I used the c program from this link and got something like:
C ->ANSI_X3.4-1968
en_GB ->UTF-8
en_US ->UTF-8
POSIX ->ANSI_X3.4-1968
Finally
export LC_ALL=en_US
export LANG=en_US
After that, I had no errors about locals. Hope that help any of you.

- 71
- 6
You could use profile.d and write a recipe as follows:
DESCRIPTION = "Copy scripts to profile.d"
LICENSE = "CLOSED"
SRC_URI = "file://*"
GLIBC_GENERATE_LOCALES="en_GB.UTF-8 en_US.UTF-8"
IMAGE_LINGUAS = "en-us"
RDEPENDS_${PN} = "bash"
do_install () {
install -d ${D}/etc/profile.d
install -m755 ${WORKDIR}/lang.sh ${D}/etc/profile.d
}
you need a subfolder where the shell script is located, name doesnt matter, because the line:
SRC_URI = "file://*"
sources the subfolder.
The shell script lang.sh
:
#!/bin/bash
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Place the shell script in that subfolder and add the name of the recipe to your image target :)

- 61
- 1