[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.

TL:DR

  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

Calamares installer

The Calamares installer adds the locales chosen to the end of /etc/locale.gen so check the last lines 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 ( KDE/Plasma :eyes: ) it can be difficult to locate the offending setting because scripts and rc configurations can change locale outside the obvious locations.

The first place to look when dealing with KDE/Plasma is usually ~/.config/plasma-localerc.

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
                  LC_NUMERIC=da_DK.UTF-8
                  LC_TIME=da_DK.UTF-8
                  LC_MONETARY=da_DK.UTF-8
                  LC_PAPER=da_DK.UTF-8
                  LC_NAME=da_DK.UTF-8
                  LC_ADDRESS=da_DK.UTF-8
                  LC_TELEPHONE=da_DK.UTF-8
                  LC_MEASUREMENT=da_DK.UTF-8
                  LC_IDENTIFICATION=da_DK.UTF-8
       VC Keymap: dk-latin1
      X11 Layout: dk
       X11 Model: pc105

Check installed locales

$ locale -a
C
en_DK.utf8
en_US.utf8
POSIX

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      
C
da_DK.utf8
en_DK.utf8
en_US.utf8
POSIX

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.
22 Likes
I lost the terminal
Unable to change GDM keyboard layout
Gnome-terminal won't open
[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
Terminal won't load
[Stable Update] 2021-03-18 - Kernels, Plasma, Frameworks, LibreOffice, Firefox, Systemd
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
Garbled characters in file manager
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
Issues with french locale
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
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
Unable to set UK keyboard layout on RPI400
Issue with Application Locale Settings on Manjaro KDE Plasma (Wayland)
K3b error regarding locale charset
I installed manjaro using Chinese and now can't set all softwares to English
I can't type words in vim
Perl Locale Warning
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?
Terminal Bash error, i no longer have access to the Terminal after last stable update
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
Keyboard & Mouse gets frozen after re-login via LightDM into Hyprland
[Testing Update] 2022-06-07 - Kernels, Mesa 22.1.1, Haskell, Perl, Python, Pamac
Grsync nur noch in englischer Sprache
Setting language in Manjaro settings does nothing
Can't download or open any file that contains Arabic characters
Bluetooth cannot find any devices
Extensions and locale broken after update/reboot
Manjaro locale problems
Problemas con el idioma en gedit en kde
Keyboard layout help
Change date format for locale / region
Rofi failed to set locale
Changing locales
Changing locales
Changed system language from French to English, but it remains partially in French
KDE do not works with custom locale
Unable to log in after standby when working with different keyboard language
Manjaro Settings Manager - Locale settings - Language
Can't change the Language in System Settings > Region & Language
Locale and error messages
Auto change time himself my system
大佬们 请问这种有办法解决吗 有老哥会嘛指导一下。
Even though I have set English as system language, Pamac's output is displayed in Italian when executed from a terminal
Language changing
Help with NVIDIA drivers and folder languages
Password issues
Changing KDE language settings messed up locale
Is sorting in Dolphin file manager broken?
[Stable Update] 2023-08-11 - Kernels, Plasma, Nvidia, Firefox, Thunderbird, Pamac, Pipewire, Mesa
[HowTo] Use multiple languages in KDE Plasma
Gnome Settings and Manjaro Settings not working together (Region & Language)
[root tip] Topic Collection List View
Comment - eliminated perl locale errors reported in Konsole
The symbol '|' is unusable in terminal
KDE 5.27.10 traducción al español sólo parcial
Can't change number and date format
Cannot add accent marks over Greek vowels after installing Greek language
Mkinitcpio, update-grub and inxi (among others) shows locale errors
My system is in arabic and I can’t find the way to get all back to italian
German umlaut ä not working
Konsole terminal language is false
Konsole terminal language is false
Fonts and language and pamac
Unicode characters not displayed
Can't set Login or Lock screen time to default to displaying 24 hour clock
System booted in another language and I can't change it back
Keine Tonausgabe
Problem with locale settings and i3
Unit systemd-vconsole-setup.service has failed
Libreoffice: fonts gone - styles changed - language randomized
XDG choose file opens unreadable list
[Stable Update] 2025-02-04 - Kernels, KDE, XFCE, Mesa, Cosmic, Systemd
(Plasma-related?) Webcam LED permanently turned on without usage
Blinking cursor screen at boot after updating to kernel 6.12.11-1
[Stable Update] 2025-02-04 - Kernels, KDE, XFCE, Mesa, Cosmic, Systemd
Password not working in terminal after successful login
Disable AUR updates in Pamac GUI
How to set the default printer size to Letter?
Main keyboard language reverts to secondary upon reboot
After update problem with terminal app and Touchpad
Xfce Desktop language / Manjaro settings manager - unable to switch (back) to en_US.UTF-8
[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

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

3 Likes

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:

4 Likes

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
C
en_US.utf8
fr_FR.utf8
POSIX
[meuh@ordi1 ~]$
1 Like

2 posts were merged into an existing topic: Manjaro Settings Manager - Locale settings - Language