openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
822 stars 251 forks source link

LC_ALL cannot be set #706

Closed mstormi closed 4 years ago

mstormi commented 5 years ago
(ssh -v)

debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = de_DE.UTF-8
debug1: Sending env LC_CTYPE = de_DE.UTF-8
debug1: Sending env LC_ALL = de_DE.UTF-8
Linux openhab 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Sep  6 10:19:57 2019 from 192.168.178.40
-bash: warning: setlocale: LC_ALL: cannot change locale (de_DE.UTF-8)
openhabian@openhab:~ $ sudo bash
[sudo] password for openhabian:
bash: warning: setlocale: LC_ALL: cannot change locale (de_DE.UTF-8)
root@openhab:/home/openhabian#
root@openhab:/home/openhabian# exit
openhabian@openhab:~ $ echo $TERM
xterm
openhabian@openhab:~ $ echo "$LANG X $LANGUAGE X $LC_CTYPE X $LC_ALL"
en_GB.UTF-8 X  X de_DE.UTF-8 X de_DE.UTF-8
openhabian@openhab:~ $ export LC_ALL=de_DE.UTF-8
-bash: warning: setlocale: LC_ALL: cannot change locale (de_DE.UTF-8)
openhabian@openhab:~ $
mstormi commented 5 years ago

does anyone know if we need it at all (given there's also LC_CTPYE, LANG and LANGUAGE) ?

holgerfriedrich commented 5 years ago

Does dpkg-reconfigure locales fix the problem?

mstormi commented 5 years ago

Does dpkg-reconfigure locales fix the problem?

Interactively started, yes. That however does not work during install. It also depends on user preferences if locale is none of the default English+German. openhabian.conf[.dist] has a line locales="en_US.UTF-8 de_DE.UTF-8" and dpkg-reconfigure locales is called in locale_setting() so I would expect that to work already, but obviously it does not.

mstormi commented 5 years ago

See also errors in install log https://github.com/mstormi/openhabian/blob/shellcheck/first-boot.log#L450 and below

This is on using menu option 12 (set locale) EDIT: menu 12 does not (no longer?) call locale_setting(). Unattended install still does, though.

2019-09-07_23:04:17_CEST [openHABian] Setting locale based on user choice...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8"
    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...

This is what happens during installation. So the German locale IS generated at the beginning, but the errors below (on variable assignment in shell !) are strange.

[90;01m$ dpkg-reconfigure --frontend=noninteractive locales 
+ dpkg-reconfigure --frontend=noninteractive locales
Generating locales (this might take a while)...
  de_DE.UTF-8... done
  en_GB.UTF-8... done
  en_US.UTF-8... done
Generation complete.
+ return 0
+ cond_redirect LANG=en_US.UTF-8
+ '[' -n '' ']'
+ echo -e '\n\033[90;01m$ LANG=en_US.UTF-8 \033[39;49;00m'

$ LANG=en_US.UTF-8 
+ LANG=en_US.UTF-8
/opt/openhabian/functions/helpers.bash: line 24: LANG=en_US.UTF-8: command not found
+ return 127
+ cond_redirect LC_ALL=en_US.UTF-8
+ '[' -n '' ']'
+ echo -e '\n\033[90;01m$ LC_ALL=en_US.UTF-8 \033[39;49;00m'

$ LC_ALL=en_US.UTF-8 
+ LC_ALL=en_US.UTF-8
/opt/openhabian/functions/helpers.bash: line 24: LC_ALL=en_US.UTF-8: command not found
+ return 127
+ cond_redirect LC_CTYPE=en_US.UTF-8
+ '[' -n '' ']'
+ echo -e '\n\033[90;01m$ LC_CTYPE=en_US.UTF-8 \033[39;49;00m'

$ LC_CTYPE=en_US.UTF-8 
+ LC_CTYPE=en_US.UTF-8
/opt/openhabian/functions/helpers.bash: line 24: LC_CTYPE=en_US.UTF-8: command not found
+ return 127
+ cond_redirect LANGUAGE=en_US.UTF-8
+ '[' -n '' ']'
+ echo -e '\n\033[90;01m$ LANGUAGE=en_US.UTF-8 \033[39;49;00m'

$ LANGUAGE=en_US.UTF-8 
+ LANGUAGE=en_US.UTF-8
/opt/openhabian/functions/helpers.bash: line 24: LANGUAGE=en_US.UTF-8: command not found
+ return 127
+ export LANG LC_ALL LC_CTYPE LANGUAGE
+ cond_redirect update-locale 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8'
+ '[' -n '' ']'
+ echo -e '\n\033[90;01m$ update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \033[39;49;00m'

[90;01m$ update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8 [39;49;00m
+ update-locale 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8'
+ return 0
+ echo OK
OK
ozarchie commented 4 years ago

I found a solution to this by editing the locale file in /etc/default.

_#  File generated by update-locale
LANG=en_AU.utf-8
LC_ALL=en_AU.utf-8
LANGUAGE=en_AU.utf-8_

Previously, it only had LANG=en_AU.UTF-8 and generated the warnings about values that were not set. Using locale -av gives:

[15:25:55] openhabian@openhab:/etc/default$ locale -av
locale: de_DE.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | German locale for Germany
   source | Free Software Foundation, Inc.
  address | http://www.gnu.org/software/libc/
    email | bug-glibc-locales@gnu.org
 language | German
territory | Germany
 revision | 1.0
     date | 2000-06-24
  codeset | UTF-8

locale: en_AU.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | English locale for Australia
   source | RAP
  address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark
    email | bug-glibc-locales@gnu.org
 language | Australian English
territory | Australia
 revision | 1.0
     date | 2000-06-29
  codeset | UTF-8

locale: en_GB.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | English locale for Britain
   source | RAP
  address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark
  contact | Keld Simonsen
    email | bug-glibc-locales@gnu.org
 language | British English
territory | United Kingdom
 revision | 1.0
     date | 2000-06-28
  codeset | UTF-8

locale: en_US.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | English locale for the USA
   source | Free Software Foundation, Inc.
  address | http://www.gnu.org/software/libc/
    email | bug-glibc-locales@gnu.org
 language | American English
territory | United States
 revision | 1.0
     date | 2000-06-24
  codeset | UTF-8

locale: C.UTF-8         directory: /usr/lib/locale/C.UTF-8
-------------------------------------------------------------------------------
    title | C locale
    email | aurel32@debian.org
 language | C
 revision | 1.6
     date | 2016-08-08
  codeset | UTF-8
[15:25:58] openhabian@openhab:/etc/default$

so while the C locale is C.UTF-8 all others are ll_cc.utf8.

I don't know if it was the change in case or adding the two extra lines .. Hope it helps.

Effelder commented 4 years ago

I could not start my grafana server on my openhab.

_[18:52:50] openhabian@openhab:~$ sudo systemctl enable grafana-server Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable grafana-server perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LANGUAGE=en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").

I already installed the language but still does not work. does anybody has an idea?

mstormi commented 4 years ago

I could not start my grafana server on my openhab.

Then open a thread on the community and don't capture our issue. Please.

PS: read the previous post edit that file

mstormi commented 4 years ago

Cannot reproduce after #742 was merged so will close for the time being. Reopen if you encounter this again.

ARandomGitHubUser commented 3 years ago

I am encountering this issue again. System info:

Raspberry Pi 3B+ Rev 1.3
OpenHAB 3.0.2 - Release Build
Kernal: Linux 5.10.17-v7+

openhabian-config reports: openHABian Configuration Tool <80><94> [openHAB3]{2021-05-05T15:53:37-06:00}(3e35b6d)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8 UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ARandomGitHubUser commented 3 years ago

@mstormi I don't have permission to reopen the issue

mstormi commented 3 years ago

this is 2yrs old option 12 does not exist any more so clearly not the same thing

open a new issue and provide a comprehensive description what you did and debug logging that shows input and output