Kadin2048
December 2nd, 2008, 07:47 PM
I spent the good portion of a day figuring this little annoyance out, and since I didn't find a solution elsewhere in the forms (and all the other threads about it are currently closed), I thought I'd post both my problem and the solution I found here, in the hopes it might help someone else out down the road.
I upgraded from 6.06 LTS to 8.04 LTS, and after rebooting started getting the "can't set locale" error on lots of commands.
For example:
$ man
man: can't set the locale; make sure $LC_* and $LANG are correct
What manual page do you want?
I also started getting lots of email from cron, telling me that all my cron tasks were getting the same error. (In some cases I have cron tasks running every few minutes so there were a lot of messages.)
I tried many of the solutions suggested elsewhere, including running dpkg-reconfigure locale and other stuff.
What I discovered was that my LANG variable was set incorrectly. To check this, I looked at the output of echo $LANG and saw that I was getting en_US when what I should have been getting was en_US.UTF-8.
Basically, the solution was to edit /etc/environment (not .bashrc or .bash_profile; they would not have solved the issue of getting the error from cron jobs), removing the existing LANG entry and adding:
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
This seemed to take care of the problem. Apparently the entry for LANG that was in there, which was LANG="en_US", was correct in 6.06 but wrong in 8.04, and wasn't updated by the installation scripts.
Hope this helps someone.
I upgraded from 6.06 LTS to 8.04 LTS, and after rebooting started getting the "can't set locale" error on lots of commands.
For example:
$ man
man: can't set the locale; make sure $LC_* and $LANG are correct
What manual page do you want?
I also started getting lots of email from cron, telling me that all my cron tasks were getting the same error. (In some cases I have cron tasks running every few minutes so there were a lot of messages.)
I tried many of the solutions suggested elsewhere, including running dpkg-reconfigure locale and other stuff.
What I discovered was that my LANG variable was set incorrectly. To check this, I looked at the output of echo $LANG and saw that I was getting en_US when what I should have been getting was en_US.UTF-8.
Basically, the solution was to edit /etc/environment (not .bashrc or .bash_profile; they would not have solved the issue of getting the error from cron jobs), removing the existing LANG entry and adding:
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
This seemed to take care of the problem. Apparently the entry for LANG that was in there, which was LANG="en_US", was correct in 6.06 but wrong in 8.04, and wasn't updated by the installation scripts.
Hope this helps someone.