Every time I run yum install or yum update, I get

Failed to set locale, defaulting to C

and then other information.

How can I avoid getting this warning?

migrated from stackoverflow.com Sep 2 '11 at 19:53

This question came from our site for professional and enthusiast programmers.


I put the following locale relating setting in /etc/bashrc (for all users, bash):

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

then run:

source /etc/bashrc

or log off and log on.

  • 2
    This should probably go into /etc/profile.d/lang.sh and not to /etc/bashrc which is likely to be overwritten by an update. – ccpizza Jan 9 '17 at 22:16
  • @ccpizza I put those lines at the bottom of lang.sh and it worked 👍. – Andrew Keeton Sep 8 '18 at 18:09


yum reinstall glibc-common

and then make sure that no process is deleting the /usr/lib/locale/locale-archive.* files.

  • 1
    I tried this first and it helps for me (not checked the process) – chro Jul 25 '14 at 19:29
  • This doesn't work for me. – Angelo Oct 5 '15 at 7:15
  • 2
    In newer Red Hat-based Linux distributions (Fedora 24+, RHEL 8+) this will be glibc-langpack-<language>, e.g. glibc-langpack-en. – Michael Hampton Sep 19 '16 at 2:40
  • In the Centos Docker image there's a reported bug: bugzilla.redhat.com/show_bug.cgi?id=1392855 – Rowinson Gallego Dec 7 '18 at 14:37

I was getting same error on MacOS. When you ssh to a linux box, they refuse to setup an UTF-8 locale. You can see the differences in locale setting by running locale command on your MacOS terminal and Linux box.

To fix this error open terminal -> preferences -> profiles -> Advanced and unset Set locale environment variables on startup on your mac.

Now when you run locale on mac. you can see that this change has set LC_CTYPE="C" which was LC_CTYPE="UTF-8" with previous setting.

you will have to close your terminal to take this effect and now login to your linux box and run yum update.

Hope it helps :)


You can try

export LANG=en_US

Or set it to something similar. If that resolves the issue for you, you can make it persistent by modifying the bash profile.

  • That didn't work for me. Any other suggestions – ctilley79 Oct 12 '12 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy