Perl warning Setting locale failed in Debian

he warning message during the installation of Perl applications will appear as follows:

  1. perl: warning: Setting locale failed.
  2. perl: warning: Please check that your locale settings:
  3. LANGUAGE = (unset),
  4. LC_ALL = (unset),
  5. LANG = "en_US.utf8"
  6. are supported and installed on your system.
  7. perl: warning: Falling back to the standard locale ("C").

This problem may arise when packages are being added. The following example will show a corresponding output:

~# apt-get install multipath-tools

Generating locales

Missing locales are generated with locale-gen:

  1. locale-gen en_US.UTF-8

Alternatively a locale file can be created manually with localedef:[1]

localedef -i en_US -f UTF-8 en_US.UTF-8

Setting Locale Settings

The locale settings can be set (to en_US.UTF-8 in the example) as follows:

  1. export LANGUAGE=en_US.UTF-8
  2. export LANG=en_US.UTF-8
  3. export LC_ALL=en_US.UTF-8
  4. locale-gen en_US.UTF-8
  5. dpkg-reconfigure locales

The dpkg-reconfigure locales command will open a dialog under Debian for selecting the desired locale.

The code has been tested and works

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image