Techolac - Computer Technology News
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games
No Result
View All Result
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games
No Result
View All Result
Techolac - Computer Technology News
No Result
View All Result
Home Linux

Perl: warning: Setting locale failed in Debian and Ubuntu

by Editorial Staff
December 31, 2020
in Linux
Reading Time: 9 mins read

 

I am trying to install package and doing some other work. But, getting the error that read as “perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:” How do I fix this problem on my Debian Linux server?

The warning message displayed when Perl based applications called. For example, apt/apt-get internally use Perl to do management of packages in Debian or Ubuntu Linux.

Adblock detected 😱
My website is made possible by displaying online advertisements to my visitors. I get it! Ads are annoying but they help keep this website running. It is hard to keep the site running and producing new content when so many people block ads. Please consider donating money to the nixCraft via PayPal/Bitcoin, or become a supporter using Patreon.

 

Perl: warning: Setting locale failed in Debian and Ubuntu

Here is a sample session created by apt-get command / apt command:
$ sudo apt-get install iperf
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  iperf
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/57.2 kB of archives.
After this operation, 164 kB of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_IN.UTF-8",
	LC_MONETARY = "en_IN.UTF-8",
	LC_MEASUREMENT = "en_IN.UTF-8",
	LC_NUMERIC = "en_IN.UTF-8",
	LC_PAPER = "en_IN.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package iperf.
(Reading database ... 40493 files and directories currently installed.)
Preparing to unpack .../iperf_2.0.9+dfsg1-1_amd64.deb ...
Unpacking iperf (2.0.9+dfsg1-1) ...
Setting up iperf (2.0.9+dfsg1-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_IN.UTF-8",
	LC_MONETARY = "en_IN.UTF-8",
	LC_MEASUREMENT = "en_IN.UTF-8",
	LC_NUMERIC = "en_IN.UTF-8",
	LC_PAPER = "en_IN.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_IN.UTF-8",
	LC_MONETARY = "en_IN.UTF-8",
	LC_MEASUREMENT = "en_IN.UTF-8",
	LC_NUMERIC = "en_IN.UTF-8",
	LC_PAPER = "en_IN.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_IN.UTF-8",
	LC_MONETARY = "en_IN.UTF-8",
	LC_MEASUREMENT = "en_IN.UTF-8",
	LC_NUMERIC = "en_IN.UTF-8",
	LC_PAPER = "en_IN.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
iperf
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/57.2 kB of archives.
After this operation, 164 kB of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “en_IN.UTF-8”,
LC_MONETARY = “en_IN.UTF-8”,
LC_MEASUREMENT = “en_IN.UTF-8”,
LC_NUMERIC = “en_IN.UTF-8”,
LC_PAPER = “en_IN.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package iperf.
(Reading database … 40493 files and directories currently installed.)
Preparing to unpack …/iperf_2.0.9+dfsg1-1_amd64.deb …
Unpacking iperf (2.0.9+dfsg1-1) …
Setting up iperf (2.0.9+dfsg1-1) …
Processing triggers for man-db (2.7.6.1-2) …
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “en_IN.UTF-8”,
LC_MONETARY = “en_IN.UTF-8”,
LC_MEASUREMENT = “en_IN.UTF-8”,
LC_NUMERIC = “en_IN.UTF-8”,
LC_PAPER = “en_IN.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “en_IN.UTF-8”,
LC_MONETARY = “en_IN.UTF-8”,
LC_MEASUREMENT = “en_IN.UTF-8”,
LC_NUMERIC = “en_IN.UTF-8”,
LC_PAPER = “en_IN.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “en_IN.UTF-8”,
LC_MONETARY = “en_IN.UTF-8”,
LC_MEASUREMENT = “en_IN.UTF-8”,
LC_NUMERIC = “en_IN.UTF-8”,
LC_PAPER = “en_IN.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).

See also  How Common Signals are Used in Kubernetes Pod Management

Understanding locales in Ubuntu and Debian Linux

Locales are a framework to switch between multiple languages and allow users to use their language, country, characters, collation order, date and time, etc. Make sure you set locales generating UTF-8 locales. Other character sets can be set for backwards compatibility with older systems and software.

How to fix Perl: warning: Setting locale failed in Debian and Ubuntu

Type the following commands to fix it. I am using en_US.UTF-8. You can see list of all localisation in /etc/locale.gen using the cat command:
cat /etc/locale.gen
OR
more /etc/locale.gen
Another option is to use grep command to search for specific locales.

## For example, search for English India ##
grep en_IN /etc/locale.gen
 
## Search for English US ##
grep en_US /etc/locale.gen
 
## Search for Japanese ##
grep ja_JP /etc/locale.gen

## For example, search for English India ##
grep en_IN /etc/locale.gen ## Search for English US ##
grep en_US /etc/locale.gen ## Search for Japanese ##
grep ja_JP /etc/locale.gen

Perl: warning: Setting locale failed in Debian

Understanding “ja_JP.UTF-8” or “en_US.UTF-8”

The ja_JP.UTF-8 defined character encoding for Japanese language users as follows:

  1. Locale is ja_JP
  2. Encoding is UTF-8

Similarly, en_US.UTF-8 is for English user from USA:

  1. So locale is set to en_US
  2. And encoding is set to UTF-8

To view current information about the current locale, or all locales, on your screen run locale command:
locale
Sample outputs:

LANG=en_IN.UTF-8
LC_CTYPE="en_IN.UTF-8"
LC_NUMERIC=en_IN.UTF-8
LC_TIME=en_IN.UTF-8
LC_COLLATE="en_IN.UTF-8"
LC_MONETARY=en_IN.UTF-8
LC_MESSAGES="en_IN.UTF-8"
LC_PAPER=en_IN.UTF-8
LC_NAME="en_IN.UTF-8"
LC_ADDRESS="en_IN.UTF-8"
LC_TELEPHONE="en_IN.UTF-8"
LC_MEASUREMENT=en_IN.UTF-8
LC_IDENTIFICATION="en_IN.UTF-8"
LC_ALL=

LANG=en_IN.UTF-8
LC_CTYPE=”en_IN.UTF-8″
LC_NUMERIC=en_IN.UTF-8
LC_TIME=en_IN.UTF-8
LC_COLLATE=”en_IN.UTF-8″
LC_MONETARY=en_IN.UTF-8
LC_MESSAGES=”en_IN.UTF-8″
LC_PAPER=en_IN.UTF-8
LC_NAME=”en_IN.UTF-8″
LC_ADDRESS=”en_IN.UTF-8″
LC_TELEPHONE=”en_IN.UTF-8″
LC_MEASUREMENT=en_IN.UTF-8
LC_IDENTIFICATION=”en_IN.UTF-8″
LC_ALL=

How to generate locales on Debian or Ubuntu Linux

Run the locale-gen command to generate locales from /etc/locale.gen for English USA user:
$ sudo locale-gen
OR
$ sudo locale-gen en_US.UTF-8
One can run the following too:
$ sudo localedef -i en_US -f UTF-8 en_US.UTF-8

How to fix a locale setting warning from Perl in Debian and Ubuntu Linux

Personally, I fixed it as follows using combination of the export command, locale-gen command and dpkg-reconfigure command:
$ sudo export LANGUAGE=en_US.UTF-8
$ sudo export LANG=en_US.UTF-8
$ sudo export LC_ALL=en_US.UTF-8
$ sudo locale-gen en_US.UTF-8

Sample outputs:

See also  How to Connect Ubuntu Linux Remotely from Windows via RDP
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

Generating locales (this might take a while)…
en_US.UTF-8… done
Generation complete.

Open the dialog box:
$ sudo dpkg-reconfigure locales
Setting Locale Settings on Ubuntu Linux
Next, set defaults to fix a locale setting warning from Perl:
How to fix a locale setting warning from Perl
Now you set up correct locales and test with apt/apt-get:
$ sudo apt install foo

Conclusion

This page showed you how to use the dpkg-reconfigure and other commands to set up the desired locale. Setting up correct locales is essential. Hence, you ran into the problem, and we configured the locales in Debian or Ubuntu to fix it. For more information see this and this page about locale encodings.

Related Posts

Top Commands to Check the Running Processes in Linux
Linux

Top Commands to Check the Running Processes in Linux

May 27, 2022
4 Tips to Prevent and Troubleshoot the ImagePullBackOff Kubernetes Error
Linux

4 Tips to Prevent and Troubleshoot the ImagePullBackOff Kubernetes Error

March 30, 2022
How Common Signals are Used in Kubernetes Pod Management
Linux

How Common Signals are Used in Kubernetes Pod Management

November 20, 2021

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

30 F2Movies Alternatives To Watch Movies And TV Shows Online

30 F2Movies Alternatives To Watch Movies And TV Shows Online

August 7, 2022
Accountable2You

Top 14 Best Accountable2You Alternatives In 2022

August 7, 2022
30 CMovies Alternatives To Watch Movies And TV Shows Online

30 CMovies Alternatives To Watch Movies And TV Shows Online

August 6, 2022
Expert Tips To Buy An Extended Car Warranty

Expert Tips To Buy An Extended Car Warranty

August 6, 2022
7 Benefits of Construction Bidding Software You Should Know

7 Benefits of Construction Bidding Software You Should Know

August 6, 2022
  • DashTech
  • TechDaddy
  • Terms and Conditions
  • Disclaimer
  • Write for us

© Techolac © Copyright 2019 - 2022, All Rights Reserved.

No Result
View All Result
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games

© Techolac © Copyright 2019 - 2022, All Rights Reserved.

Go to mobile version