[root tip] [How To] Troubleshooting locale errors

Difficulty: ★☆☆☆☆

Locale Errors

Locale errors are not always obvious and some applications simply stop working without any hints at all - e.g. Gnome Terminal is very sensitive to incorrect configuration of locale.


  1. As root edit the file /etc/locale.gen
  2. Enable the needed locales - including en_US.UTF-8 UTF-8 as fallback.
  3. Rebuild the locale database using the locale-gen script

The Calamares installer adds the locales chosen to the end of /etc/locale.gen so check the bottom of the file before editing - it looks something like this

# Locales enabled by Calamares
en_US.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
da_DK.UTF-8 UTF-8

General locale configuration

From time to time an update may install locale.gen as locale.gen.pacnew - do not blindly overwrite your existing locale.gen. Before applying the new file - check the locales in use and reapply the configuration after applying the .pacnew file.

If you have been modifying locale and are having locale trouble (:point_right: KDE) it can be difficult to locate the offending setting because scripts and rc configurations can change locale outside the obvious locations.

Locale error message

From my notepad

When you get errors like these examples - it is not obvious what causes it

$ rofi

(process:1628): Rofi-WARNING **: 07:34:43.942: Failed to set locale.
$ sterminal
couldn't read from shell: Input/output error
child exited with status 1
tmux: invalid LC_ALL, LC_CTYPE or LANG

Check your settings

:information_source: Obviously you need to replace the locale with something relevant for your system. I have written this using my system’s locale - en_DK for messages and da_DK for the rest of the system.

Check locale settings

$ localectl      
   System Locale: LANG=en_DK.UTF-8
       VC Keymap: dk-latin1
      X11 Layout: dk
       X11 Model: pc105

Check installed locales

$ locale -a

The installed locales does not match the settings listed by localectl - as you can see the da_DK part is missing.

Fix locale error

It is recommended to use the utf8 version unless you have compelling reasons to select otherwise.

Method 1

Edit /etc/locale.gen and ensure that all in-use locales has been uncommented. For fallback messages enable en_US as well

$ sudo nano /etc/locale.gen
#cy_GB ISO-8859-14  
da_DK.UTF-8 UTF-8  
#da_DK ISO-8859-1  
#en_CA ISO-8859-1  
en_DK.UTF-8 UTF-8  
#en_DK ISO-8859-1  
#en_SG ISO-8859-1  
en_US.UTF-8 UTF-8  
#en_US ISO-8859-1  

Method 2

Based on the comment by @nam1962 (see below).

Check if the locale you want to use is available in the locale list (/etc/locale.gen)

$ cat /etc/locale.gen | grep 'da_DK'
#da_DK.UTF-8 UTF-8  
#da_DK ISO-8859-1

Use sed command

  • To enable a locale (uncommenting the line)

    $ sudo sed -i '/en_DK.UTF-8/s/^#//g' /etc/locale.gen
    $ sudo sed -i '/en_US.UTF-8/s/^#//g' /etc/locale.gen
  • To disable a locale (aka commenting the locale)

    $ sudo sed -i '/en_DK.UTF-8/s/^/#/g' /etc/locale.gen

Rebuild locales

$ sudo locale-gen
Generating locales...
  da_DK.UTF-8... done
  en_DK.UTF-8... done
  en_US.UTF-8... done
Generation complete.

Recheck your locales

$ locale -a      

Verify it works

➜  ~ rofi -r
Rofi is unsure what to show.
Please specify the mode you want to show.

    rofi -show {mode}

The following modi are enabled:
 * window
 * run
 * ssh

The following can be enabled:
 * windowcd
 * drun
 * combi
 * keys

To activate a mode, add it to the list of modi in the modi setting.
I lost the terminal
[Stable Update] 2020-09-08 - Kernels, Mesa, Browsers, KDE Apps 20.08.1, Systemd, LibreOffice 7.0.1, Deepin
Terminal not opening after updating Manjaro 9th Feb, 2021
Gnome-terminal won't open
Czech language pack problem with installation
How do I set manjaro language do PT-BR?
Add 12h/24h settings support
[Stable Update] 2021-04-18 - Kernels, Mesa, Wine, Plasma5, KDE Frameworks, LibreOffice, Bluez
[Stable Update] 2021-02-09 - Kernels, Gnome 40-Alpha, KDE Apps 20.12.2, Systemd, Mesa, LibreOffice
Gnome-terminal wont open after update
Localization breakdown
Kwalletmanager, do i need it?
I can't use accents in browsers
Language issue, can't change languange
After installing deno terminal not starting, pulseeffects not detecting audio devices, can't install software
[Stable Update] 2021-04-28 - Kernels, Wine, Ruby, JDK, KDE-Dev, Mesa 21.0.3, KDE Apps 21.04, Python, Haskell, Mate 1.24.2, Virtualbox, Thunderbird
Language settings Issue
[Stable Update] 2021-02-28 - Kernels, Plasma 5.21.1, Frameworks 5.79, Firefox, Thunderbird, Python
Language lost after reboot (German locale)
[Stable Update] 2021-02-19 - Kernels, AMDVLK, Palemoon, Firefox-dev, Firefox, Haskell, Python
Latin keyboard-layouts should display comma on KP_Decimal
Как установить английский интерфейс с поддержкой кирилицы?
Typing quote character with shift now activates accents
[SOLVED] Zsh prompt problem/error after update
Zsh prompt broken after this week update
Problem with locale configuration settings
Gnome Terminal & en_US.UTF-8 UTF-8
After installing Steam from pamac language switches partly to english & terminal can't be opened
Man: can't set the locale; make sure $LC_* and $LANG are correct
Canberra-gtk-module warning
Locales gone wild
Is there any way to switch between English and Korean keyboards?
[SOLVED] Zsh prompt problem/error after update
Locale settings broken again after update
[Stable Update] 2021-06-07 - Kernels, Perl, Haskell, Tesseract, Cutefish, KDE, Nvidia
Bsdtar: Failed to set default locale
Xterm terminal has incorrect language/alphabet in menu
Kwin_xkbcommon: XKB: couldn't find a Compose file for locale "en_IN"
Perl issue with locale
Unicode characters not displayed
Language settings lost
Shell messages in wrong language
Gnome-terminal won't run after update
Annoying perl locale warnings
Touchpad not working out of the box
Firefox "Take Screenshot" issue
K3b error regarding locale charset
I installed manjaro using Chinese and now can't set all softwares to English
Fonts and language and pamac
Regional Settings
Password of the user only works for initial log in and then it changes
Can't set default language to english
Manjaro-settings-manager language issue
Is there any way to switch between English and Korean keyboards?
On one of two Manjaro systems language support not working for pacman -Qi output
Why does Manjaro have such localisation issues?
Screen turn black and only mouse cursor
Displayed time wrong,
How to change system language?
Can't change keyboard layout
Locale not properly set/interpreted by applications started from KDE causes problems with filenames with special characters
One Keyboard Button not clicking
Can't change system language
How to change Locale Settings -> System Locales in terminal?
Permanently change one key mapping in keyboard layout
Konsole terminal language is false
After update problem with terminal app and Touchpad
[Testing Update] 2022-06-07 - Kernels, Mesa 22.1.1, Haskell, Perl, Python, Pamac
Grsync nur noch in englischer Sprache
Can't download or open any file that contains Arabic characters
Bluetooth cannot find any devices
German umlaut ä not working
Extensions and locale broken after update/reboot
Konsole terminal language is false
[Stable Update] 2021-04-09 - Kernels, Systemd, Gnome 40 Apps, Mesa 21.0.1, Kernels, Browsers
Problem tlp.service longtime booting and longtime shutdown - Gnome
[Stable Update] 2021-03-08- Kernels, Plasma 5.21.2, Haskell, Kodi, Grub, KDE-Dev
[Testing Update] 2021-02-05 - Kernels, Gnome 40-Alpha, KDE Apps 20.12.2, Systemd, Mesa, LibreOffice 7.1
Japanese Issue Solved, but then Come Back?
Anyone know how to fix this message?
Kde locale swedish
No terminal after fresh install
Terminal won't load
Unable to change GDM keyboard layout
[Stable Update] 2021-03-18 - Kernels, Plasma, Frameworks, LibreOffice, Firefox, Systemd

Moved to #contributions:Tutorials so it appears at the top instead of all the way at the bottom of #contributions


I have french user I installed, they don’t even know nano exists.

Thus I told them :

sudo sed -i '/en_US.UTF-8/s/^#//g' /etc/locale.gen
sudo sed -i '/fr_FR.UTF-8/s/^#//g' /etc/locale.gen
sudo locale-gen

For other languages, just replace fr_FR with the proper locale

[Edit] to reverse & comment out :
sed -i '/fr_FR.UTF-8/s/^/#/g' /etc/locale.gen
with the proper locale :wink:


Nice idea - I will add it to the guide :slight_smile: thank you.

1 Like

Thank you for praising :wink:

By the way, my checking outcome is a little different :

[meuh@ordi1 ~]$ localectl
   System Locale: LANG=fr_FR.UTF-8
   VC Keymap: fr
  X11 Layout: fr
   X11 Model: pc105
[meuh@ordi1 ~]$ locale -a
[meuh@ordi1 ~]$
1 Like

2 posts were split to a new topic: Inxi reports locale error

A post was split to a new topic: Locale issues on gnome