If you are trying to use the
perl command in your terminal or execute a script coded in the language, you may encounter the
Falling back to the standard locale error. This indicates that your Linux system is missing a particular software package that Perl relies on, or the software has become corrupted or misconfigured. In this tutorial, we will show you how to remedy the error and get your
perl command working again.
In this tutorial you will learn:
- How to fix the
Falling back to the standard localeerror message on all major Linux distros
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Falling back to the standard locale – Solution
The error occurs when trying to execute a Perl script or just using the
perlcommand in terminal. It looks like this:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
The problem is that your system’s locale is not set. You may be missing the software entirely or just have not configured the locale. This message may appear for example when you are installing new packages into your Linux system. Fortunately, there is an easy fix to this problem.
Depending on which Linux distro you are using, follow the appropriate set of instructions below to remedy this error.
Debian-based and Ubuntu solution
- First make sure that you have the
$ sudo apt update $ sudo apt install locales
The previous command will install locales package or it will output that locales is already installed.
- Next, use the
dpkg-reconfigurecommand to configure the locales package.
$ sudo dpkg-reconfigure locales
- Use the menu that shows up to reconfigure your locales. For example,
en_US.UTF-8 UTF-8for English speaking Americans. Pick the appropriate one for you.
RHEL-based and Fedora Solution
- First, search for the appropriate language pack inside of the official software repositories:
$ dnf search langpacks-
- Once you find the right one, install it with
dnf. For example, English speakers would need
$ sudo dnf install langpacks-en
- Next, use the following command to list all of the locales available on your system.
$ localectl list-locales
- Once you have identified the proper one for your system, set your locale with the
localectl set-localecommand. In our case, we will set our locale to
$ sudo localectl set-locale en_US.UTF-8
Arch Linux based and Manjaro
- Open the
/etc/locale.genin nano or your favorite text editor.
$ sudo nano /etc/locale.gen
- Uncomment the locale that you wish to use on your system, and make sure others are commented out if you do not plan to use them. Save the changes when you are done with your edits
- For these changes to take effect, run the
$ sudo locale-gen
In this tutorial, we saw how to resolve the
perl: warning: Falling back to the standard localeerror message on a Linux system. Having your locale misconfigured or unset on Linux will cause problems with Perl, which may manifest as errors during package installation and other ordinary terminal tasks. The instructions here cover all major Linux distros, so you can get Perl working again regardless of what type of Linux system you are running.