Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1841601

Summary: subscription-manager fails when locale is not English
Product: Red Hat Enterprise Linux 8 Reporter: Juan Orti Alcaine <jortialc>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 8.2CC: cdonnell, cshao, csnyder, dfediuck, jhnidek, jsefler, lsurette, lsvaty, mavital, mtessun, nlevy, peyu, qiyuan, redakkan, sbonazzo, shlei, weiwang, yaniwang, ycui
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: subscription-manager-1.27.15-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:39:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Juan Orti Alcaine 2020-05-29 14:18:44 UTC
Description of problem:

subscription-manager fails in RHVH host when the LANG is not English. exporting LANG=C or LANG=en_US.UTF-8 fixes the issue.

# localectl 
   System Locale: LANG=en_US.UTF-8
       VC Keymap: es
      X11 Layout: es,us
     X11 Variant: ,

# env | egrep 'LC|LANG'
LANG=es_ES.UTF-8

# subscription-manager refresh
You are attempting to use a locale that is not installed.
1 certificado local ha sido borrado.
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 142: ordinal not in range(128)
Call stack:
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.26.16', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 863, in _do_command
    self.entcertlib.update()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update
    self.report = self.locker.run(self._do_update)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run
    return action()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update
    return action.perform()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 131, in perform
    log.info('certs updated:\n%s', self.report)
Message: 'certs updated:\n%s'
Arguments: (<subscription_manager.entcertlib.EntCertUpdateReport object at 0x7f55383f65f8>,)
Todos los datos actualizados


Version-Release number of selected component (if applicable):
rhvh-4.4.0.18-0.20200417.0
subscription-manager-1.26.16-1.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install rhvh-4.4.0.18-0.20200417 with English and Spanish language support
2. From the console, using subscription manager is fine. LANG=en_US.UTF-8
3. Connecting by SSH using a non-English locale. In my case, the LANG is set automatically to 'es_ES.UTF-8'
4. Run any subscription-manager command


Actual results:
Errors of the kind:
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 142: ordinal not in range(128)

Expected results:
No errors.

Additional info:

Comment 1 Douglas Schilling Landgraf 2020-05-29 21:22:07 UTC
Probably workaround is: env -i LC_ALL=C subscription-manager refresh. Assigning the right ovirt-node component.

Comment 2 Rehana 2020-06-05 14:25:56 UTC
Hi Juan , 

Thanks for opening the bug. Our developers are unable to reproduce this issue locally. Can you please help us with a reproducer environment ? 

thanks in advance, 
Rehana

Comment 3 Juan Orti Alcaine 2020-06-09 07:58:36 UTC
These are the steps I use:

1. Install VM using ISO file RHVH-4.4-20200417.0-RHVH-x86_64-dvd1.iso
   Anaconda options:
   - Use English (US) during the installation process.
   - Set first keyboard layout to Spanish.
   - Select language support English (US) and Spanish (Spain).
   - Default options everywhere else.

2. When connecting to the VM from my laptop using SSH, the LANG var is set to Spanish. Then, I try to register the machine and it reports "You are attempting to use a locale that is not installed" and many errors are displayed.

[juan@juan-laptop ~]$ env | egrep 'LANG|LC'
GDM_LANG=es_ES.UTF-8
LANG=es_ES.UTF-8

[juan@juan-laptop ~]$ localectl 
   System Locale: LANG=es_ES.UTF-8
       VC Keymap: es
      X11 Layout: es

[juan@juan-laptop ~]$ ssh root@rhvh44

# env | egrep 'LANG|LC'
LANG=es_ES.UTF-8

# localectl 
   System Locale: LANG=en_US.UTF-8
       VC Keymap: es
      X11 Layout: es,us
     X11 Variant: ,

# subscription-manager register
You are attempting to use a locale that is not installed.
Registrándose a: subscription.rhsm.redhat.com:443/subscription
Nombre de usuario: XXXXXX
Contrase?a: XXXXX
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 121: ordinal not in range(128)
Call stack:
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.26.16', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1370, in _do_command
    type=self.options.consumertype
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/register.py", line 66, in register
    facts_dict = self.facts.get_facts()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 78, in get_facts
    facts = collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/all.py", line 35, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/host_collector.py", line 55, in get_all
    firmware_info_dict = firmware_collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/firmware_info.py", line 69, in get_all
    firmware_info = self.get_firmware_info()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/firmware_info.py", line 62, in get_firmware_info
    firmware_info_dict = firmware_info_collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/dmiinfo.py", line 93, in get_all
    self.log_warnings(dmidecode)
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/dmiinfo.py", line 130, in log_warnings
    log.warn(_("Error reading system DMI information: %s"), dmiwarnings, exc_info=True)
Message: 'Error en la lectura de información de DMI del sistema:%s'
Arguments: ('# SMBIOS implementations newer than version 2.7 are not\n# fully supported by this version of dmidecode.\n\n',)
El sistema ha sido registrado con ID: XXXX-XXXX-XXXX
El nombre del sistema registrado es: rhvh44
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 121: ordinal not in range(128)
Call stack:
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.26.16', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1407, in _do_command
    facts.write_cache()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 111, in write_cache
    json.dump(self.to_dict(), f, default=json.encode)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 84, in to_dict
    return self.get_facts()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 78, in get_facts
    facts = collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/all.py", line 35, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/host_collector.py", line 55, in get_all
    firmware_info_dict = firmware_collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/firmware_info.py", line 69, in get_all
    firmware_info = self.get_firmware_info()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/firmware_info.py", line 62, in get_firmware_info
    firmware_info_dict = firmware_info_collector.get_all()
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/dmiinfo.py", line 93, in get_all
    self.log_warnings(dmidecode)
  File "/usr/lib64/python3.6/site-packages/rhsmlib/facts/dmiinfo.py", line 130, in log_warnings
    log.warn(_("Error reading system DMI information: %s"), dmiwarnings, exc_info=True)
Message: 'Error en la lectura de información de DMI del sistema:%s'
Arguments: ('# SMBIOS implementations newer than version 2.7 are not\n# fully supported by this version of dmidecode.\n\n',)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 142: ordinal not in range(128)
Call stack:
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.26.16', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1434, in _do_command
    self.entcertlib.update()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update
    self.report = self.locker.run(self._do_update)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run
    return action()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update
    return action.perform()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 131, in perform
    log.info('certs updated:\n%s', self.report)
Message: 'certs updated:\n%s'
Arguments: (<subscription_manager.entcertlib.EntCertUpdateReport object at 0x7f95def41128>,)


3. If using LANG=en_US.UTF-8 there is no errors:

# export LANG=en_US.UTF-8

# subscription-manager unregister
Unregistering from: subscription.rhsm.redhat.com:443/subscription
System has been unregistered.

# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: XXXXXX
Password: XXXXXX
The system has been registered with ID: XXXX-XXXX-XXXX
The registered system name is: rhvh44

Comment 4 John Sefler 2020-06-09 14:11:18 UTC
Is the glibc-langpack-es package installed?
Can you run... "rpm -q glibc-langpack-es"

Comment 5 Juan Orti Alcaine 2020-06-09 15:14:17 UTC
(In reply to John Sefler from comment #4)
> Is the glibc-langpack-es package installed?

No, it is not:

# rpm -qa | grep glibc-langpack
glibc-langpack-en-2.28-101.el8.x86_64

Comment 10 Rehana 2020-08-21 11:06:58 UTC
Reproducing the error on:=
==========================
subscription-manager: 1.27.13-1.el8

[root@dhcp35-44 ~]# env | egrep 'LANG|LC'
LANG=es_ES.UTF-8
[root@dhcp35-44 ~]# 
[root@dhcp35-44 ~]# localectl 
   System Locale: LANG=es_ES.UTF-8
       VC Keymap: es
      X11 Layout: es

[root@dhcp35-44 ~]# subscription-manager register
You are attempting to use a locale that is not installed.
Registrándose a: subscription.rhsm.stage.redhat.com:443/subscription
Nombre de usuario: rhel8_rhsm_testing_1
Contrase?a: 
El sistema ha sido registrado con ID: de31f805-3ead-4465-b98d-9ae0ec121dff
El nombre del sistema registrado es: dhcp35-44.lab.eng.blr.redhat.com
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 142: ordinal not in range(128)
Call stack:
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.27.13', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3287, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 547, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1663, in _do_command
    self.entcertlib.update()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update
    self.report = self.locker.run(self._do_update)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run
    return action()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update
    return action.perform()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 131, in perform
    log.info('certs updated:\n%s', self.report)
Message: 'certs updated:\n%s'
Arguments: (<subscription_manager.entcertlib.EntCertUpdateReport object at 0x7ff4f54f5e48>,)


Verifying on : 
=============
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.16-1
subscription management rules: 5.40
subscription-manager: 1.27.15-1.el8

# rpm -qa subscription-manager --changelog | grep 1841601
- 1841601: Set default encoding properly; ENT-2499 (jhnidek)

# rpm -qa lang*  
langpacks-en-1.0-12.el8.noarch

# localectl status
   System Locale: LANG=es_ES.UTF-8
       VC Keymap: us
      X11 Layout: us


# subscription-manager register
You are attempting to use a locale: "es_ES.UTF-8" that is not fully supported by this system.
Registrándose a: subscription.rhsm.stage.redhat.com:443/subscription
Nombre de usuario: rhel8_rhsm_testing_1
Contraseña: 
El sistema ha sido registrado con ID: be313f89-5c9e-403c-bc22-f89df23df804
El nombre del sistema registrado es: ibm-x3650m4-02-vm-01.ibm2.lab.eng.bos.redhat.com

^^ Notice system was successfully registered with no traceback 

Based on the above observations , moving the bug to verified.

Comment 13 errata-xmlrpc 2020-11-04 01:39:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (subscription-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4460