How to fix perl: warning: Please check that your locale settings in APT

APTBEGINNERMEDIUMUpdated Dec 29, 2025ยท 210 views

This Perl warning occurs when system locale settings are not properly configured on Debian/Ubuntu systems. The warning appears when Perl detects that environment variables like LC_ALL, LANG, or LANGUAGE are unset or point to unsupported locales. It can be fixed by generating missing locales or setting appropriate environment variables.

Quick fix

Fixes perl: warning: Please check that your locale settings

locale -a
  1. Check available locales on your system
  2. Generate missing locales (Debian/Ubuntu)
  3. Set locale environment variables
  4. For SSH connections, disable locale forwarding
apt โ€” error
locale -a
perl: warning: Please check that your locale settings

What this error means

Perl emits this warning when it cannot load the locale specified by your environment variables. This typically happens on fresh Debian or Ubuntu installations where locales haven't been generated, or when connecting via SSH and locale environment variables are passed from a client machine that has different locale settings. Perl falls back to a default locale (like en_US.UTF-8) but still warns you about the mismatch.

Typical symptoms

  • Perl warning message appears in command output
  • Warning shows unset LC_ALL, LANG, or LANGUAGE variables
  • Perl scripts still run but with warning noise
  • Build tools (like cpan or cpanm) display locale warnings
  • Warning appears especially when connecting via SSH

Common causes

  1. System locales are not generated on the host system
  2. SSH client sends locale environment variables that don't exist on the server
  3. LC_ALL, LANG, or LANGUAGE environment variables point to missing locales
  4. Fresh Debian/Ubuntu installation without locale configuration
  5. Docker container or minimal Linux environment without locale data

How to fix "perl: warning: Please check that your locale settings"

1Check available locales on your system

First, see which locales are currently available:

bash
locale -a

This lists all installed locales. Common ones are en_US.UTF-8, C, and C.UTF-8.

2Generate missing locales (Debian/Ubuntu)

If you need a specific locale that's missing, generate it:

bash
sudo locale-gen en_US.UTF-8

Then update the system locale configuration:

bash
sudo dpkg-reconfigure locales

Select at least one locale (usually en_US.UTF-8) and confirm it as the default.

3Set locale environment variables

Add these variables to your shell profile (~/.bashrc, ~/.bash_profile, or ~/.zshrc):

bash
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Then reload your shell:

bash
source ~/.bashrc
4For SSH connections, disable locale forwarding

If you're connecting remotely via SSH, your client machine's locale variables may be forwarded to the server. On your local machine, edit ~/.ssh/config:

bash
Host *
    SendEnv LANG LC_*

Change to:

bash
Host *
    SendEnv LANG

Or comment out the SendEnv line entirely to prevent locale forwarding.

5Quick temporary fix

If you need an immediate solution without reconfiguring the system:

bash
export LC_ALL=C

Or:

bash
export LC_ALL=C.UTF-8

This disables locale-specific behavior and resolves the warning. This is temporary and only lasts for the current session.

Advanced notes

For Docker containers, add locale generation to your Dockerfile before installing Perl:

dockerfile
RUN apt-get update && apt-get install -y locales && \
    locale-gen en_US.UTF-8 && \
    update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

The LC_ALL variable takes precedence over both LANG and individual LC_* variables (like LC_CTYPE, LC_NUMERIC, etc.). Setting LC_ALL=C disables all locale-specific behavior but is less efficient than properly configuring locales. On systems like Arch Linux, uncomment desired locales in /etc/locale.gen and run 'locale-gen' instead of using dpkg-reconfigure.

Frequently asked questions

What does "perl: warning: Please check that your locale settings" mean?
Perl emits this warning when it cannot load the locale specified by your environment variables. This typically happens on fresh Debian or Ubuntu installations where locales haven't been generated, or when connecting via SSH and locale environment variables are passed from a client machine that has different locale settings. UTF-8) but still warns you about the mismatch.
How do I fix "perl: warning: Please check that your locale settings"?
This Perl warning occurs when system locale settings are not properly configured on Debian/Ubuntu systems. The warning appears when Perl detects that environment variables like LC_ALL, LANG, or LANGUAGE are unset or point to unsupported locales. It can be fixed by generating missing locales or setting appropriate environment variables.
What causes "perl: warning: Please check that your locale settings"?
System locales are not generated on the host system SSH client sends locale environment variables that don't exist on the server LC_ALL, LANG, or LANGUAGE environment variables point to missing locales
Is the "perl: warning: Please check that your locale settings" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading