Bug 1203464 - Several console commands(including zypper) ignore locale settings
Several console commands(including zypper) ignore locale settings
Status: NEW
Classification: openSUSE
Product: openSUSE Distribution
Classification: openSUSE
Component: Other
Leap 15.4
x86-64 openSUSE Leap 15.4
: P5 - None : Normal (vote)
: ---
Assigned To: E-mail List
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-09-15 17:13 UTC by Fedor Dudinskiy
Modified: 2022-10-03 07:16 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
mfilka: needinfo? (mvidner)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fedor Dudinskiy 2022-09-15 17:13:42 UTC
I am running a system with English as a default language and most locales[1][2] set to en_US.UTF-8. At the same time, some output from several console applications, including zypper, as well as a default language for YAST are in Russian[3][4], or are use some kind of mix language[5].

It looks like, that during initial installation OS somehow "remembered" the locale and kept in some separate file/variable.
It worth mentioning, that this behavior exists only in UI, if I log in through "Alt+F1", everything is in English, as expected.
See also similar bug for Tumbleweed: https://bugzilla.opensuse.org/show_bug.cgi?id=911401

[1]
```
~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.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=ru_RU.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
```

[2]
~> localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us
```
[3]
~> zypper se zypper
Загрузка данных о репозиториях...
Чтение установленных пакетов...

S | Name                      | Summary                                          | Type
--+---------------------------+--------------------------------------------------+-----------------------
  | monitoring-plugins-zypper | Check for software updates via zypper            | пакет
i | zypper                    | Command line software manager using libzypp      | пакет
  | zypper                    | Command line software manager using libzypp      | пакет с исходным кодом
  | zypper-aptitude           | aptitude compatibility with zypper               | пакет
  | zypper-docker             | Easy patch and update solution for Docker images | пакет
i | zypper-lifecycle-plugin   | Zypper subcommand for lifecycle information      | пакет
i | zypper-log                | CLI for accessing the zypper logfile             | пакет
  | zypper-migration-plugin   | Zypper subcommand for online migration           | пакет
i | zypper-needs-restarting   | needs-restarting compatibility with zypper       | пакет

```
[4]
```
stat /
  Файл: /
  Размер: 226           Блоков: 0          Блок В/В: 4096   каталог
Устройство: 812h/2066d  Инода: 96          Ссылки: 21
Доступ: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
```
[5]
```
~> man --no-such-flag
man: нераспознанный параметр «--no-such-flag»
Try 'man --help' or 'man --usage' for more information.
```
Comment 1 Michal Filka 2022-09-19 07:21:43 UTC
What's the output of "zypper locales"? Thanks
Comment 2 Fedor Dudinskiy 2022-09-20 15:40:19 UTC
~> zypper locales
Code  | Language                | Requested
------+-------------------------+------------
en    | English                 | Резервные
en_US | English (United States) | Запрошенные


Translation of the last column: en is "Reserved", en_US is "Requested"
Comment 3 Stefan Hundhammer 2022-09-21 08:54:58 UTC
Please check /etc/sysconfig/language, in particular ROOT_USES_LANG.

sh@balrog-tw-dev:~> grep '=' /etc/sysconfig/language
INPUT_METHOD=""
RC_LANG=""
RC_LC_ALL=""
RC_LC_MESSAGES=""
RC_LC_CTYPE=""
RC_LC_COLLATE=""
RC_LC_TIME=""
RC_LC_NUMERIC=""
RC_LC_MONETARY=""
RC_LC_PAPER=""
ROOT_USES_LANG="ctype"
AUTO_DETECT_UTF8="no"
INSTALLED_LANGUAGES="en_US"


Also, please be aware about the differences of locale settings for your own user account, in your desktop, with "sudo" and if you really log in as root.


sh@balrog-tw-dev:~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

sh@balrog-tw-dev:~> sudo locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

sh@balrog-tw-dev:~> su -
Password: 
balrog-tw-dev:~ # locale
LANG=POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Comment 4 Stefan Hundhammer 2022-09-21 08:55:56 UTC
balrog-tw-dev:~ # whoami
root

balrog-tw-dev:~ # locale
LANG=POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Comment 5 Fedor Dudinskiy 2022-09-22 17:23:16 UTC
Stefan, thank you for the suggestion, results are below:

~> grep '=' /etc/sysconfig/language
INPUT_METHOD=""
RC_LANG=""
RC_LC_ALL=""
RC_LC_MESSAGES=""
RC_LC_CTYPE=""
RC_LC_COLLATE=""
RC_LC_TIME=""
RC_LC_NUMERIC=""
RC_LC_MONETARY=""
RC_LC_PAPER=""
ROOT_USES_LANG="ctype"
AUTO_DETECT_UTF8="no"
INSTALLED_LANGUAGES=""

~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.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=ru_RU.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

~> sudo locale
[sudo] пароль для root:  # translation: "the password for root"
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.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=ru_RU.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

~> su -
Пароль:  #translation : password
localhost:~ # whoami
root
localhost:~ # locale
LANG=POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

It seems, that everything is as expected, yet Russian language still is in the logs.

The result from a virtual console(alt+F1) only differs in LC_MEASUREMENT field(it is "en_US.UTF-8" there) for both locale/sudo locale and it doesn't have Russian language prompts
Comment 6 Stefan Hundhammer 2022-09-26 08:51:30 UTC
Fedor, thanks for checking those things. Indeed everything seems to indicate that you should get English, not Russian, in the shell environment.

One small thing is that INSTALLED_LANGUAGES in /etc/sysconfig/language is empty in your case, but it contains "en_US" in mine.

Still, if no language packs (translation files) are installed, it should fall back to "ctype" or "POSIX" which means "use the built-in messages for all programs" which by convention is English.

Did you try the YaST language module to explicitly set the language to English? (Maybe change it to Russian first before clicking "Apply" and then back to English to make sure.) That might be worth a try.

To the best of my knowledge, we don't store the selected language in YaST in any other place than in /etc/sysconfig/language, but I'll double-check.
Comment 7 Stefan Hundhammer 2022-09-26 09:02:53 UTC
It's also a bit weird that "localectl" in your case does not report a system locale.

  [sh @ balrog-tw-dev] ~ 4 % localectl

     System Locale: LANG=en_US.UTF-8
         VC Keymap: de-nodeadkeys
        X11 Layout: de
         X11 Model: microsoftpro
       X11 Variant: nodeadkeys
       X11 Options: terminate:ctrl_alt_bksp

According to "man localectl", it stores its values in /etc/locale.conf and in /etc/vconsole.conf:

  [sh @ balrog-tw-dev] ~ 5 % cat /etc/locale.conf 

  LANG=en_US.UTF-8


Maybe this is where that "ru_RU.UTF-8" value is hiding.


  [sh @ balrog-tw-dev] ~ 6 % cat /etc/vconsole.conf

  KEYMAP=de-nodeadkeys
  FONT=eurlatgr.psfu
  FONT_MAP=
  FONT_UNIMAP=
Comment 8 Stefan Hundhammer 2022-09-26 09:07:47 UTC
(In reply to Stefan Hundhammer from comment #7)
> It's also a bit weird that "localectl" in your case does not report a system
> locale.

Duh; it does. I just overlooked it. My fault.
Comment 9 Stefan Hundhammer 2022-09-26 09:11:55 UTC
Please check if you have any of those files on your system:

  /etc/install.inf
  /etc/yast.inf

and if you do, please check if they contain anything that might point to selecting the.
Comment 10 Stefan Hundhammer 2022-09-26 14:56:54 UTC
(In reply to Stefan Hundhammer from comment #9)
> and if you do, please check if they contain anything that might point to
> selecting the
... Russian language.
Comment 11 Fedor Dudinskiy 2022-09-26 17:15:42 UTC
~> cat /etc/locale.conf 
LANG=en_US.UTF-8
~> cat /etc/vconsole.conf 
KEYMAP=us
FONT=eurlatgr.psfu
FONT_MAP=
FONT_UNIMAP=


~> ls /etc/ | grep inf
binfmt.d
terminfo


Changing language pack in Yast to Russian and then back to English: didn't worked. Surprisingly, Yast is also in Russian(but rest of the system, including System Settings and Applications Menu are in English). Is it possible for some language settings be in UI-related files, or something to be set up during visual login?
Comment 12 Michal Filka 2022-10-03 07:16:25 UTC
(In reply to Fedor Dudinskiy from comment #0)
> I am running a system with English as a default language and most
> locales[1][2] set to en_US.UTF-8. At the same time, some output from several
> console applications, including zypper, as well as a default language for
> YAST are in Russian[3][4], or are use some kind of mix language[5].
> 
> It looks like, that during initial installation OS somehow "remembered" the
> locale and kept in some separate file/variable.
> It worth mentioning, that this behavior exists only in UI, if I log in
> through "Alt+F1", everything is in English, as expected.
> See also similar bug for Tumbleweed:
> https://bugzilla.opensuse.org/show_bug.cgi?id=911401
> 
@Martin
the TW bug is assigned to you. Do you have some findings / comments related to the topic?