perl: warning: Setting locale failed

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = “de_AT.UTF-8”,
LC_ALL = “de_DE.UTF-8”,
LC_MESSAGES = “de_DE.UTF-8”,
LC_COLLATE = “de_DE.UTF-8”,
LC_CTYPE = “de_DE.UTF-8”,
LANG = “de_AT.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).

Or during apt operations:

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

I often got this error message working remote with debian or ubuntu vms. I didn’t find out how to fix the problem, but I found a workaround. Just add the following lines at the end of your /etc/profile or the user’s .bashrc:

LC_CTYPE="de_AT.UTF-8"
export LC_CTYPE
LC_MESSAGES="de_AT.UTF-8"
export LC_MESSAGES
LC_ALL="de_AT.UTF-8"
export LC_ALL

Just make sure the chosen locale (de_AT.UTF-8) is installed. You can use dpkg-reconfigure locales to check/do this.

Leave a Comment