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:
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.
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.
The system with such issue was installed through graphic web console by PXE step by step.
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.
(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 ```
(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.
(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.
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.