How to fix perl: warning: Please check that your locale settings in APT
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- Check available locales on your system
- Generate missing locales (Debian/Ubuntu)
- Set locale environment variables
- For SSH connections, disable locale forwarding
locale -aperl: 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
- 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
- Fresh Debian/Ubuntu installation without locale configuration
- Docker container or minimal Linux environment without locale data
How to fix "perl: warning: Please check that your locale settings"
First, see which locales are currently available:
locale -aThis lists all installed locales. Common ones are en_US.UTF-8, C, and C.UTF-8.
If you need a specific locale that's missing, generate it:
sudo locale-gen en_US.UTF-8Then update the system locale configuration:
sudo dpkg-reconfigure localesSelect at least one locale (usually en_US.UTF-8) and confirm it as the default.
Add these variables to your shell profile (~/.bashrc, ~/.bash_profile, or ~/.zshrc):
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8Then reload your shell:
source ~/.bashrcIf 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:
Host *
SendEnv LANG LC_*Change to:
Host *
SendEnv LANGOr comment out the SendEnv line entirely to prevent locale forwarding.
If you need an immediate solution without reconfiguring the system:
export LC_ALL=COr:
export LC_ALL=C.UTF-8This 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:
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-8The 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.