Fixing invalid locale settings in Debian 8
Linux
Table of contents:
You might have met this before. Indeed! Very annoying. This is due to unset of locale variable in Debian environment specifically for Perl applications.
1Can't set locale; make sure $LC_* and $LANG are correct!
2perl: warning: Setting locale failed.
3perl: warning: Please check that your locale settings:
4LANGUAGE = (unset),
5LC_ALL = (unset),
6LC_CTYPE = "UTF-8",
7LANG = "en_US.UTF-8"
8are supported and installed on your system.
9perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
10locale: Cannot set LC_CTYPE to default locale: No such file or directory
11locale: Cannot set LC_ALL to default locale: No such file or directory
To solve the above issue you need
- Generate locale (if needed). There is
locale-gen
tool under Debian. - Set environment variables (via export).
- Reconfigure locales by
dpkg-reconfigure
tool.
Here we go with step-by-step shell commands:
1export LANGUAGE=en_US.UTF-8
2export LANG=en_US.UTF-8
3export LC_ALL=en_US.UTF-8
4locale-gen en_US.UTF-8
5dpkg-reconfigure locales
Hope it helps, but if there are any questions - feel free to use the form below!