Failed to set locale, defaulting to C warning message on CentOS Linux when running yum

The “Failed to set locale, defaulting to C” warning message is displayed when the system cannot detect the correct locale setting for your environment. This can cause issues with applications like Yum, as it relies on correct locale settings. To resolve this issue, you need to set the correct locale in your environment. (https://pragermetis.com)

To do this on CentOS, follow these steps:

  1. Check the available locales on your system by running:
$ locale -a
  1. Determine the correct locale for your environment and set it using the locale command:
$ sudo locale LC_ALL="en_US.UTF-8"
  1. Update the locale settings in the system-wide locale configuration file:
$ sudo nano /etc/locale.conf

Add the following line:

LC_ALL="en_US.UTF-8"
  1. Save and close the file, then log out and log back in for the changes to take effect.
  2. Verify the changes by checking the locale settings:
$ locale

You should now no longer see the “Failed to set locale, defaulting to C” warning message when running Yum.

Leave a Comment