Error “trid: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed” (SOLVED)
September 1, 2021
When running this or that command, you may encounter an error in which the word “loadlocale.c” appears. You can report this bug to the author so that he can fix it, as it is more of a program bug. However, there are several ways to fix this error.
As you can tell from the “locale” string, the error is locale-related.
An example of an error:
trid: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed. Aborted (core dumped)
The most common advice is to run before the command:
export LC_ALL=C
And then execute the command that caused the error – the error should disappear.
But this tip can break fonts in some other applications. Therefore, use this method with LC_ALL as a fallback if something is not set (as in the case above, this is LC_TIME).
Another tip is to do the following:
LANG=/usr/lib/locale/en_US
and then run the problematic command – that should work as well. This may have fewer side effects on fonts in other languages.
It also offers a way to fix this problem on a permanent basis – handy if you frequently run the command causing an error with loadlocale.c.
First, edit the /etc/locale.gen file and add the locales you want.
For example, in my case:
en_US.UTF-8 UTF-8 ru_RU.UTF-8 UTF-8
Now run as root:
sudo rm -f /usr/lib/locale/locale-archive sudo locale-gen --no-archive sudo locale-gen --no-archive en_US.UTF-8 sudo locale-gen --no-archive ru_RU.UTF-8
The --no-archive flag is important, use it as shown in the commands.
Related articles:
- How to change Linux language without reinstalling my OS (99.4%)
- How to translate Linux with Cinnamon into my language (69.8%)
- Analogue of the --force option in pacman (50.6%)
- How to downgrade to a previous kernel in Arch Linux (50.6%)
- bash: finger: command not found in Arch Linux (RESOLVED) (50.6%)
- How to install Kali Linux with full disk encryption (RANDOM - 50%)