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 1949559 - "setlocale: No such file or directory" when running virsh commands
Summary: "setlocale: No such file or directory" when running virsh commands
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: glibc
Version: 8.4
Hardware: x86_64
OS: Unspecified
low
low
Target Milestone: beta
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-14 14:37 UTC by Eduardo Minguez
Modified: 2023-07-18 14:30 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-10 09:13:07 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)

Description Eduardo Minguez 2021-04-14 14:37:24 UTC
Description of problem:
Fresh installed RHEL8.3 with latest updates, running `virsh` commands shows the "setlocale: No such file or directory" message. It is just cosmetic as everything works.

Version-Release number of selected component (if applicable):
$ virsh --version
setlocale: No such file or directory
6.0.0
$ rpm -qf /usr/bin/virsh 
libvirt-client-6.0.0-28.1.module+el8.3.0+10448+0c705bc6.x86_64

How reproducible:
Fresh install RHEL8.3 minimal with libvirt

Steps to Reproduce:
1. Install rhel8
2. install libvirt stuff
3. run virsh --version

Actual results:
setlocale: No such file or directory
6.0.0


Expected results:
6.0.0


Additional info:

Comment 1 Jaroslav Suchanek 2021-05-21 09:27:36 UTC
I tried to reproduce it,

1) Downloaded RHEL-8.4.0-20210503.1-x86_64-dvd1.iso
2) Created VM using virt-manager and installed 'Minimal' installation
3) Subscribed the system
4) Installed libvirt using, yum install libvirt\*
5) Executed virsh --version

No error message about missing setlocale binary was printed.

Can you please reproduce it with RHEL-8.4? What steps am I missing? Thanks.

Comment 3 yalzhang@redhat.com 2021-06-07 08:48:45 UTC
I have compared 2 rhel 9 system, one with such issue and another has no such issue, and found it may related with the glibc-langpack-en package. The system with such error has glibc-minimal-langpack installed and no glibc-langpack-en; while the healthy system has glibc-langpack-en which provides more information required to support the English language in your applications.
And the error not only report when we execute virsh commands, but many other commands like "yum".

On system with such issue:
# virsh start rhel 
setlocale: No such file or directory
Domain 'rhel' started

# 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_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=C.UTF-8
LC_TIME=C.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=C.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=C.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=C.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

# rpm -qa | grep glibc
glibc-minimal-langpack-2.33-14.el9.x86_64
glibc-common-2.33-14.el9.x86_64
glibc-2.33-14.el9.x86_64

# yum install -y glibc-langpack-en
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Unable to read consumer identity
......
Installed:
  glibc-langpack-en-2.33-14.el9.x86_64                                                                                                        

Complete!

# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=C.UTF-8
LC_TIME=C.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=C.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=C.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=C.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

# virsh list --all
 Id   Name   State
----------------------
 4    rhel   running

while the healthy system:
# rpm -qa | grep glibc
glibc-langpack-en-2.33-13.el9.x86_64
glibc-common-2.33-13.el9.x86_64
glibc-2.33-13.el9.x86_64

I think we may need to check if there is some changes for glibc-langpack-en, like "it exists in minimal install before, but removed recently" or "any dependency removed recently". BTW, This is not a libvirt bug.

Comment 4 yalzhang@redhat.com 2021-06-07 10:31:10 UTC
The system with such issue was installed through graphic web console by PXE step by step.

Comment 6 Florian Weimer 2021-06-10 05:22:45 UTC
This looks like another instance of bug 1958876, this time reported against Red Hat Enterprise Linux 8.

Eduardo, what is the locale setting on the installed system (“locale” output)? And which glibc packages are installed on the system (“rpm -qa | grep glibc”)? Thanks.

I believe not installing weak dependencies is a deliberate result of choosing a minimal install, with bug 1331100 fixed.

Comment 7 Eduardo Minguez 2021-06-10 07:54:29 UTC
(In reply to Florian Weimer from comment #6)
> This looks like another instance of bug 1958876, this time reported against
> Red Hat Enterprise Linux 8.
> 
> Eduardo, what is the locale setting on the installed system (“locale”
> output)? And which glibc packages are installed on the system (“rpm -qa |
> grep glibc”)? Thanks.
> 
> I believe not installing weak dependencies is a deliberate result of
> choosing a minimal install, with bug 1331100 fixed.

Freshly installed a RHEL8.4 VM using the ISO. Minimal packages with the following kickstart generated by anaconda:

```
graphical
repo --name="AppStream" --baseurl=file:///run/install/sources/mount-0000-cdrom/AppStream
%packages
@^minimal-environment
kexec-tools
%end
keyboard --xlayouts='us'
lang en_US.UTF-8
network  --bootproto=dhcp --device=enp1s0 --ipv6=auto --activate
network  --hostname=localhost.localdomain
cdrom
firstboot --enable
ignoredisk --only-use=vda
autopart
clearpart --none --initlabel
timezone America/New_York --isUtc
rootpw --iscrypted xxx
user --groups=wheel --name=edu --password=xxx --iscrypted --gecos="edu"
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
```

Then updated to latest packages and installed libvirt-client

```
$ sudo dnf install libvirt-client
$ virsh --version
setlocale: No such file or directory
6.0.0
```


Output requested:

```
[edu@localhost ~]$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=es_ES.UTF-8
LC_TIME=es_ES.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=es_ES.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=es_ES.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=es_ES.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[edu@localhost ~]$ rpm -qa | grep glibc
glibc-langpack-en-2.28-151.el8.x86_64
glibc-2.28-151.el8.x86_64
glibc-common-2.28-151.el8.x86_64
```

Comment 8 Florian Weimer 2021-06-10 08:13:36 UTC
(In reply to Eduardo Minguez from comment #7)
> LC_TIME=es_ES.UTF-8

Is it possible that you passed LC_TIME and other variables from your workstation over SSH? Thanks.

es_ES.UTF-8 is different from en_US.UTF-8, and not installed on the system.

Comment 9 Eduardo Minguez 2021-06-10 08:30:04 UTC
(In reply to Florian Weimer from comment #8)
> (In reply to Eduardo Minguez from comment #7)
> > LC_TIME=es_ES.UTF-8
> 
> Is it possible that you passed LC_TIME and other variables from your
> workstation over SSH? Thanks.
> 
> es_ES.UTF-8 is different from en_US.UTF-8, and not installed on the system.

Correct.

My workstation is a Fedora 33 x86_64 box and it sends some LC_* and LANG variables as you mentioned:

```
$ grep -R SendEnv /etc/ssh/ssh_config*
/etc/ssh/ssh_config.d/50-redhat.conf:	SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
/etc/ssh/ssh_config.d/50-redhat.conf:	SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
/etc/ssh/ssh_config.d/50-redhat.conf:	SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
/etc/ssh/ssh_config.d/50-redhat.conf:	SendEnv XMODIFIERS
```

Same 'SendEnv' settings are in the RHEL box:

```
$ grep -R SendEnv /etc/ssh/ssh_config*
/etc/ssh/ssh_config.d/05-redhat.conf:	SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
/etc/ssh/ssh_config.d/05-redhat.conf:	SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
/etc/ssh/ssh_config.d/05-redhat.conf:	SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
/etc/ssh/ssh_config.d/05-redhat.conf:	SendEnv XMODIFIERS
```

If I ssh and set LC_ALL to en_US.UTF-8:

```
$ export LC_ALL="en_US.UTF-8"
$ virsh --version
6.0.0
```

Not sure if this BZ should be closed as it seems the proper behavior or maybe reassign it to virsh so if the locale is not found, provide a proper error message instead.

Comment 10 Florian Weimer 2021-06-10 09:13:07 UTC
The setlocale function only reports a single error code, so it can't tell the caller how setting the locale failed. I don't think virsh can realistically do anything about this. Sorry.


Note You need to log in before you can comment on or make changes to this bug.