Working in Debian Jessie, I enabled Debian unstable repository (same problem with testing). Afterwards, installing cmake would throw an error:

[...]
dpkg: error while cleaning up:
 subprocess rm command for cleanup was killed by signal (Aborted)
dpkg-split: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
[...]

After that, using the commandline is neigh impossible, since most commands, including sudo, throw their own error:

>$ ls
ls: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted

How can I recover from this error without shutting down the machine?

Furthermore, is this a bug in loadlocale.c? Apparently, similar issues happen all over the place:
https://github.com/junegunn/fzf/issues/356
https://www.reddit.com/r/archlinux/comments/3g9dzf/loadlocalec130_error_on_everything/
https://patchwork.openembedded.org/patch/114739/

up vote 0 down vote accepted

I figured out a solution, big thanks to these posts:
https://stackoverflow.com/questions/37121895/yocto-build-loadlocale-c-130
Problem of Can't set locale; make sure $LC_* and $LANG are correct!

However, I'm still unsure where to put the blame for this problem.

First, to get a usable commandline, $LANG needs to be defined:

>$ LANG=/usr/lib/locale/en_US

(setting LANG=en_US did NOT work, path is required!)

Afterwards, the commandline should be usable again. Edit locale.gen as root and uncomment all locales you'd want to use on your system:

>$ sudo vim /etc/locale.gen

Now run locale-gen as root and the system should be fixed.

Note: dpkg-reconfigure locales didn't work because it threw errors as well.


To avoid this issue, remove cmake before upgrading (if installed) and upgrade your system using apt-get upgrade. I was unable to figure out which package would need upgrading specifically.

I thought upgrading locales should be enough, but that didn't work since apt-get upgrade locales (or related packages) results in borken packages error:

>$ sudo apt-get upgrade locales
[...]
The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (< 2.20) but 2.27-3 is to be installed
                Recommends: manpages-dev but it is not going to be installed
 libc6-dev : Depends: libc6 (= 2.19-18+deb8u10) but 2.27-3 is to be installed
E: Broken packages

and though I believe the relevant package is console-data (since it will ask nicely what keyboard-layout you'd want to use during a full upgrade), upgrading console-data resulted in the same packages being upgraded as apt-get upgrade would have upgraded.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.