Raspberry Pi: Fixing your Locale
Fixing your Locale on Raspberry Pi
After a fresh install of Raspberry Pi OS (called Raspbian when I first wrote this) you may see the following error:
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
You can fix your locale with a few simple updates.
- Edit
/etc/locale.genand uncomment the line withen_US.UTF-8 - Run
sudo locale-gen - Run
sudo update-locale LANG=en_US.UTF-8
Log out and back in for the change to take effect. The locale-gen command builds every locale you uncommented in /etc/locale.gen, so it takes no argument. The update-locale command needs the variable name as well as the value. Without LANG=, it silently does nothing.
You can also run sudo raspi-config and choose the localisation options, which does the same work through a menu.
Changelog
2026-10-26
- Corrected the commands.
update-localeneedsLANG=en_US.UTF-8, andlocale-gentakes no argument.- Added
sudo, which both commands need.- Updated the OS name to Raspberry Pi OS and removed a duplicate heading.
For feedback, ping me on Mastodon@tuck@fosstodon.org.