Friday, December 14, 2012

man: can't set the locale; make sure $LC_* and $LANG are correct

Sometimes a new Ubuntu image will pop-up messages like:

man: can't set the locale; make sure $LC_* and $LANG are correct

It doesn't stop anything from working, it just gets annoying. It seems to be an release problem, and can be quickly fixed by adding an LC_ALL and LANG definition to /etc/environment like this:

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

Other valid values is "en_GB.UTF-8" and "en_AU.UTF-8".

After adding those lines, I had to regenerate the locales with:

$ sudo locale-gen en_US
$ sudo locale-gen en_US.UTF-8

Check out Ubuntu's Environment Variables if you want to know more.