• 1-888-289-2246
  • 24x7x365 Presence

Failed to set locale, defaulting to C


This error “Failed to set locale, defaulting to C” is generally occur on ubuntu OS when there is no locale setup permanently in the environment which you work. It most commonly comes when you do login to your ubuntu machine via ssh or while start/stop a service on it. To fix this problem follow are some ways which suited on the distribution basis using below steps :-

1)

sudo locale-gen en_US en_US.UTF-8
dpkg-reconfigure locales

dpkg-reconfigure reconfigures packages after they have already been installed.

2) However, in some ubuntu distribution it doesn’t resolve the issue with above and there need to do the following way :-

export LANG=en_US

or

Put the file below lines in /etc/environment:

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

or

Add the below line in .bashrc file :-

export LC_ALL=”en_US.UTF-8″

Note: Make sure that on your machine the language pack has been installed otherwise the above entries won’t work. So to install the language pack just run the below command :-

apt-get install language-pack-en-base  

These above are some ways as per the distribution to solve this  locale setting error.

]]>