Closed: locale set in a peculiar way when using dietpi.txt

Hello,

since updating/changing to the DietPi v119 image, which in the meantime updates itself to v126 during the first few reboots, changing the locale - either set via the DiePi-GUI or via the dietpi.txt automation script - is not working correctly. Leaving the settings to en_GB works. I’ve gone with dietpi.txt as that makes the process and the results repeatable.

These parameters were used in dietpi.txt:

#   Locale eg: en_GB en_US | Full list: cat /etc/locale.gen
AUTO_Locale=en_GB de_DE en_US

The result is:

root@dietpi:~# 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_GB
LANGUAGE=
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

Note that LANG is still en_GB. Also notice the reported error about some LCs not being set, although they are listed like all others.

Btw time zone and keyboard layout (which are set along with locale) have also been changed and work nicely.

Could somebody help me out and explain what need to be configured to have the system run on en_US.UTF-8 for all LANG and LC-parameters?



Some more observations (which could help narrow down the problem):

cat /etc/default/locale:
LANG=en_GB de_DE en_US.UTF-8

Note that there is more than one entry and only the last one has been suffixed with “.UTF-8”.

cat /etc/locale.gen | sed -n '/en_GB/p;/en_US/p;/de_DE/p'
# de_DE ISO-8859-1
# de_DE.UTF-8 UTF-8
# de_DE@euro ISO-8859-15
# en_GB ISO-8859-1
# en_GB.ISO-8859-15 ISO-8859-15
# en_GB.UTF-8 UTF-8
# en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
# en_US.UTF-8 UTF-8

/etc/locale.gen is available and has only lines with a “#” at the beginning. I would have thought at least some line (en_GB, en_US, de_DE) should be “unremarked”.


executing dpkg-reconfigure locales

starts the DietPi-GUI with “Configuring locales”. Here nothing (not even en_GB.UTF-8) is marked as localed to be generated. Choosing the same three locales (en_GB.UTF-8, en_US.UTF-8, de_DE.UTF-8) and as a default locale en_US.UTF-8 solves the problem.

root@dietpi:~# locale
LANG=en_GB
LANGUAGE=
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

LANG is still set to en_GB though…

After that, /etc/locale.gen looks as it should (to me):

cat /etc/locale.gen | sed -n '/en_GB/p;/en_US/p;/de_DE/p'
# de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
# de_DE@euro ISO-8859-15
# en_GB ISO-8859-1
# en_GB.ISO-8859-15 ISO-8859-15
en_GB.UTF-8 UTF-8
# en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
en_US.UTF-8 UTF-8

Just as /etc/default/locale does:

cat /etc/default/locale
LANG=en_US.UTF-8

Hi,



Sorry, that you stumble on this old bug,

https://github.com/Fourdee/DietPi/issues/174


Set language via ‘dietpi-config’ manually, choose ‘en_GB.UTF-8’ and ‘en_US.UTF-8’. At the next dialogue choose ‘en_US.UTF-8’ as system defaut language.
Exit ‘dietpi-config’ and answer ‘yes’ to reboot the system.

cu
k-plan

Thanks k-plan!

Addition:

Fourdee will have a look on it. :smiley:
https://github.com/Fourdee/DietPi/issues/174#issuecomment-237338456

It’ s not allowed to disable en_GB.UTF-8





https://github.com/Fourdee/DietPi/issues/291#issuecomment-211495754

because in such cases, DietPi scripts can not parse correctly.

Example:
https://github.com/Fourdee/DietPi/blob/master/dietpi/dietpi-software#L22

Default system locale can set to what ever you like, e.g. “de_DE.UTF-8 UTF-8”

cu
k-plan