OpenHABian 3.1 Set system locale - Error message

Dear all,

searching for a way to display the datetime days in German language I read that i have to set the system locale in sudo openhabian-config to German.

Setup:

  • Raspberry PI 3b+
  • OpenHABian 3.1
  • OpenHAB 3.1
  • openHABian Configuration Tool [stable]patchday-20210119-1118(b56733a)

So I went to: 30 System settings → 32 Set system locale

Selected the following line with Space and Enter

[*] de_DE.UTF-8 UTF-8

Then the following message showed up. I pushed Enter

Then i received the following error:

There was an error or interruption during the execution of:                  │
          │   "30 | System Settings"

This is the log-out put in the SSH terminal:

+ case "$choice2" in
+ locale_setting
+ local locale
+ dpkg -s locales
+ [[ -n 1 ]]
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2021-08-20_19:22:06_CEST [openHABian] Setting locale based on user choice... '
2021-08-20_19:22:06_CEST [openHABian] Setting locale based on user choice... + dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LC_CTYPE = "en_US.UTF-8",
        LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  de_DE.UTF-8... done
Generation complete.
*** update-locale: Error: invalid locale settings:  LC_ALL=en_US.UTF-8 LANG=de_DE.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8
+ echo 'FAILED (reconfigure locales)'
FAILED (reconfigure locales)
+ return 1

When i check locale in the SSH terminal, this is the output:

openhabian@openhab:~ $ 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=
LANGUAGE=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

I really dont know what to do. Can someone maybe give me a hint? :slight_smile:
Thank you!

By doing this i am afraid i also destroyed something.
Because now i see the following in the main UI:
image

I supposed to be 22.6 °C.
Also i dont see German letters like Ä,Ö,Ü anymore :frowning:

Dunno about your locale issue, but this

is bad.
The ‘stable’ branch of openHABian is for openHAB 2 and has not been updated in a long time.

Change to ‘openHAB’ or ‘main’ branch then see if that makes a difference for your issue.

You are right.
I changed it to OpenHAB3 branch and did a reboot.
After this i tried again to set the locale in system settings.
However with the same result:

+ echo -n '2021-08-21_13:06:59_CEST [openHABian] Setting locale based on user choice... '
2021-08-21_13:06:59_CEST [openHABian] Setting locale based on user choice... + dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LC_CTYPE = "en_US.UTF-8",
        LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  de_DE.UTF-8... done
Generation complete.
*** update-locale: Error: invalid locale settings:  LANGUAGE=en_US.UTF-8 LANG=de_DE.UTF-8 LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8
+ echo 'FAILED (reconfigure locales)'
FAILED (reconfigure locales)
+ return 1

After this i do at least have °C again, however still no German letters and no translation to German weekday names:
image

I think I also had that problem but do not remember how I resolved it from the command line.

But it looks like there is a mixture of en_US for LANGUAGE and de_DE for LANG.
Could this be the problem ?

What is the content of /etc/default/locale ?

It seems to be a big mess now …
Even if the mainUI shows the temperature unit °C correct the item value in the MQTT command is ?C.

Item 'HASP_demo_Plate_Command_JSON' predicted to become ['p10b52.text=17 ?C']

Same item in the Developer Sitemap:

{ "state": "16.93 °C", "displayState": "16.9 °C" }

Line of the rule:

 HASP_demo_Plate_Command_JSON.sendCommand("['p10b52.text=" + Wetter_Forecast_ForecastHours12_Temperature.state.format("%.0f °C") + "']")

At the start of the ssh terminal i also see this message at the top:

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Content of /etc/default/locale is the following

#  File generated by update-locale
#LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANGUAGE=en_US.UTF-8

Edit:
I now switched back to en_US.UTF-8 in the openhab-config.
(Deactivated de_DE.UTF-8 UTF-8 before).
Didnt receive any errors.
After a reboot I do have now correct temperature unit (°C) in mainUI and MQTT command again.
Also German letters are working again.
However, of course still english DateTime naming.

Region is set to Germany and language is set to german under settings ?

You are referring to the settings of the MainUI?
Yes MainUI Settings are set to German and Germany.

Uncomment LANG, too. Setting all of these to de_DE.UTF-8 should work.

If you want to reconfigure anything you can also run dpkg-reconfigure locales in CLI.

1 Like

You are right!
I adapted this file and set again the locale in the openhab config to German.
No errors and now its working fine!

Thank you alot!

1 Like