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)

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:


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.

Leave Your Observation

Your email address will not be published.