I am getting this message every time I do something like starting or stopping a service.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_MESSAGES = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
(Reading database ... 21173 files and directories currently installed.)
Removing bind9 ...
* Stopping domain name service... bind9 [ OK ]
Processing triggers for man-db ...
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
How do I fix this error ?
First run
locale
to list what locales currently defined for the current user account:Then generate the missing locale and reconfigure locales to take notice:
Now you will not see any errors anymore!
Nothing suggested above worked in my case (Ubuntu Server 12.04LTS). What finally helped was putting to the file
/etc/environment
:For some reason it was missing. The outputs for locale and other commands appeared like the variables were properly defined. In other words don't take for granted all the basic stuff is declared where it should be declared.
They should disappear after issuing:
dpkg-reconfigure
reconfigures packages after they have already been installed. Pass it the names of a package or packages to reconfigure. It will ask configuration questions, much like when the package was first installed.Just add the following to your
.bashrc
file (assuming you're using bash)This is a common problem if you are connecting remotely, so the solution is to not forward your locale. Edit
/etc/ssh/ssh_config
and comment outSendEnv LANG LC_*
line.There is a command for that:
It updates
/etc/default/locale
with provided values.To apply the changes, you can
What worked for me on 12.10 was this:
This was after
dpkg-reconfigure locales
produced no results.Don't forget exit your SSH session (or your X11) by exiting and logging back in again. All of these suggestions didn't work for me unless I logged back in....
For Ubuntu 12.10 none of the above worked except for ratzs' solution. I recommend adding this to your /etc/bash.bashrc file:
I was stuck in a weird state where my local machine is set to
es
and so the remote machine (viavagrant
) had been provisioned in an un-handled state. Therefore, I had to use the manualexport=
only to facilitate a successfuldpkg-reconfigure
. Then the system is fine.