Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Linux

How to Fix Locale Warnings on a Fresh Ubuntu VPS

By Freedom251 Team · · 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a fresh Ubuntu VPS, perl: warning: Setting locale failed usually means the server received a LANG or LC_* value that is not present in its generated locale database. Generate the locale you actually want, save one consistent default with update-locale, then start a new login session. If the warning appears only after SSH login, stop the client from forwarding an unsupported locale or generate that locale on the VPS.

What a locale warning means

A locale is the set of regional rules and language preferences used by programs for messages, character handling, dates, numbers and related categories. Ubuntu processes read these preferences from environment variables. LANG is the base setting. Individual LC_* variables override particular categories, while a value such as LC_ALL can impose a broad setting across the session.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The warning is not normally a Perl defect. It means that a process was given a locale name the server cannot satisfy. The requested name may not have been generated at all, or it may have arrived from your SSH client even though the VPS does not provide it. Typical messages include:

  • perl: warning: Setting locale failed
  • locale: Cannot set LC_ALL to default locale

Use locale to see the values currently in the shell and locale -a to see the locales that Ubuntu has generated. The repair is successful only when the values being requested are available in the second command’s output.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Inspect the shell before changing anything

Run both inspection commands in the affected SSH session:

locale
locale -a

The first command displays the active LANG, LC_ALL and other LC_* categories. The second lists the locale database available to applications. Compare every non-empty locale value from the first output with the names printed by the second.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Identify the mismatch

  • If LANG or an LC_* variable names a locale that is absent from locale -a, that value cannot be used until the locale is generated.
  • If the values are available but the warning appears only when connecting over SSH, the client may be forwarding a different locale during login.
  • If LANG looks correct but an LC_* value is stale, the category-specific value still has to be corrected; changing only LANG does not remove an incompatible override.

Do not guess a locale name from memory. Select a name that Ubuntu can generate and confirm its presence with locale -a after generation.

Install locale support and generate the required locale

Minimal VPS images may not include the locale support package or the locale you selected. Install the package and generate the desired UTF-8 locale with:

sudo apt update
sudo apt install locales
sudo locale-gen en_US.UTF-8

Replace en_US.UTF-8 with the exact UTF-8 locale you intend to use. Ubuntu documents locale-gen for generating all locales configured on the system or for generating one named locale. The command above requests one locale, which is usually the smallest change for a server that needs a single default.

Immediately check that generation completed:

locale -a

The requested locale must now appear in the list. If it does not, do not proceed by writing that name into the global configuration; first resolve the generation or package problem and rerun the check. A configuration that names an absent locale will continue to produce the same warning.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Generate the user’s language when translated messages matter

If the objective is to preserve a user’s language, generate that exact UTF-8 locale and use it as the default. Applications that support translations can then retain the selected language. This approach is appropriate when operators need messages in a language other than English and the VPS will consistently use that locale.

Use a standard server locale for predictable automation

If reproducible scripts, logs and package output are more important than translated messages, standardize the VPS on one known generated UTF-8 locale, such as en_US.UTF-8. All administrators and automation should then use the same supported value rather than relying on whatever locale an individual laptop sends over SSH.

Persist one consistent global setting

Generating a locale adds it to the server’s available database; it does not by itself select that locale for future logins. Persist the intended default with Ubuntu’s configuration tool:

sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

Use the locale you confirmed with locale -a. update-locale updates the global locale configuration and performs basic validity checks. Ubuntu’s documentation describes this utility as the mechanism that updates the system’s global locale settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the variables deliberate

A simple server-wide policy is to set both LANG and LC_ALL to the same generated UTF-8 locale, as in the command above. This removes a common contradiction in which one variable requests a locale while another requests an unavailable one.

There is a different valid policy when you want English messages but regional formatting. In that case, set LANG to the generated regional UTF-8 locale and leave category-specific overrides only where you intentionally need them. Do not retain an old LC_* value merely because it was copied from another machine. Every non-empty override should be supported and purposeful.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Why editing one shell startup file is not enough

Changing an exported variable in the current shell can make that one process appear fixed, but it does not establish the global default used by later logins. Use update-locale for the persistent setting, then begin a fresh session so the login environment is rebuilt from the updated configuration.

Start a fresh login session

Persistent locale changes take effect after a new login. Log out of the VPS and reconnect, or close the current shell and start a new one. Then inspect the environment again:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
locale
locale -a

A session that was already running may continue to hold the old values, so testing only inside that session can make a successful configuration look broken. The warning should disappear from package commands and other programs once the new login reports supported locale names.

Fix warnings caused by SSH locale forwarding

SSH commonly forwards locale variables from the client computer. This is useful when the server has the same locale, but it creates a warning when your laptop sends a value that the VPS has not generated. The server can be perfectly configured for its own default and still receive an unsupported value during login.

Confirm that the problem is transport-specific

Compare a normal local shell on the VPS with a new SSH connection. If the warning occurs only during SSH login, inspect the SSH client configuration used for that connection for a SendEnv LANG LC_* entry. The relevant setting may be in a per-user configuration or a system-wide client configuration, depending on how the connection is managed.

The server’s SSH configuration may also contain an AcceptEnv rule allowing those variables to be received. Acceptance does not create a locale; it only permits the client value to enter the session. The value still has to exist in the server’s generated locale database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Choose one of three transport fixes

  1. Generate the forwarded locale. Install locale support and run locale-gen for the exact client locale, then persist it if that is the locale the server should use.
  2. Standardize both sides. Configure the laptop and VPS to use the same generated UTF-8 locale. This preserves forwarding while removing the mismatch.
  3. Stop forwarding locale variables. In the SSH client configuration, comment out or remove the relevant SendEnv LANG LC_* line for the host, then reconnect. The VPS will retain its own configured locale instead of receiving the laptop’s value.

Choose the third option when the server must be reproducible regardless of the operator’s workstation. Choose the first or second when translated messages or the laptop’s regional conventions are required on the VPS.

Reconnect after changing SSH settings

SSH environment variables are established when the session starts. Disconnect and reconnect after changing client forwarding or server acceptance settings. Verify the values inside the new session with locale; checking the old connection cannot show whether the transport change worked.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the repair strategy that matches your goal

Goal Server action Result Trade-off
Preserve the user’s language Generate and persist that exact UTF-8 locale; allow forwarding only when the VPS supports it. Supported applications can continue using translated messages. Every client value that reaches the server must be generated there.
Predictable automation Generate one known UTF-8 default and set it consistently with update-locale. Scripts and package output use a stable server setting. Messages may not follow an individual operator’s laptop language.
Missing server locale Install locales, run locale-gen, verify with locale -a, then persist the default. The server can satisfy the requested locale. It changes the server’s available locale database and, if selected, its global default.
Unsupported client value over SSH Remove the relevant SendEnv LANG LC_* entry or align client and server locales. SSH no longer injects an unavailable value. The remote shell will use the VPS default rather than the laptop’s locale when forwarding is disabled.

Common failure modes and precise fixes

The locale is configured but not generated

Symptom: locale shows en_US.UTF-8, but locale -a does not list it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: Install locales if necessary, run sudo locale-gen en_US.UTF-8, and confirm the result before running update-locale. Configuration and availability must agree.

LC_ALL keeps overriding a corrected LANG

Symptom: You change LANG, yet applications still report the old or unsupported locale.

Fix: Inspect every non-empty LC_* value in the locale output. Correct or remove the stale override, then persist the intended combination with update-locale. A supported LANG cannot compensate for an unsupported category value that remains active.

The warning returns after every SSH connection

Symptom: Local commands on the VPS are quiet, but the warning returns immediately after logging in from one computer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: Treat this as an SSH forwarding issue. Check the client for SendEnv LANG LC_*, determine which value is being sent, and either generate that locale on the VPS, align the two systems, or disable forwarding for the host. Reconnect before testing.

The fix appears ineffective until a reboot

Symptom: The configuration command completed, but the current prompt still reports the old values.

Fix: Do not rely on a reboot. Log out and reconnect, or start a new shell, because Ubuntu applies persistent locale changes at fresh login. Then rerun the verification commands.

English output is expected but another language remains

Symptom: The warning is gone, but applications still display a user’s language.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: Check whether the selected LANG and category overrides intentionally request that language. If the server should be standardized for English automation, generate and select the supported English UTF-8 locale and remove conflicting overrides. If translated messages are desired, the output is consistent with the chosen policy.

Verification checklist

After reconnecting, run the following checks:

locale
locale -a | grep -i 'en_US|C.UTF-8'
printf '%sn' "$LANG" "$LC_ALL" "$LANGUAGE"
  • The configured locale names are present in locale -a.
  • A new login reports the intended LANG, LC_ALL and category values.
  • No unsupported client value is injected by SSH.
  • Package commands and other Perl-based tools no longer emit locale warnings.

The grep example checks common English and C UTF-8 names; adapt the pattern when you selected a different regional locale. The verification commands establish the state of the current session; they do not change configuration.

What Ubuntu’s documentation says about update-locale

Ubuntu’s update-locale manual describes the utility this way: “This program can be called by maintainer scripts when Debian packages are installed or removed, it updates the /etc/locale.conf file to reflect changes in system configuration related to global locale settings.” In practical terms, use the documented command to maintain the global setting rather than relying on a one-off shell export, and always validate the resulting login environment.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

LinuxLocalesserver administrationSSHUbuntuVPS

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.