8

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/

1 Answer 1

9

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.

4
  • To add a bit of how-to to GammaSQ comment: I mounted the disk image under another linux, then mounted the offending drive (mount /dev/sdb1 /mnt) then chroot /mnt. Once in the chroot drive space, I performed the commands as indicated by GammaSQ
    – TomCurrie
    Jan 7, 2019 at 4:18
  • I ran into this issue running nuXmv; setting LANG=/usr/lib/locale/en_US as you suggested fixed it. Is this something that would be considered an issue with my local system configuration, or an issue with the tool/project/whatever (in my case nuXmv) that I am trying to run? (In which case I would want to submit a bug?) Sep 10, 2019 at 16:43
  • I am no expert on the issue itself. However, I would suggest opening a bug. First because it seems to be fixable for some projects. Second because it increases the chances of someone actually able to fix it running into it.
    – GammaSQ
    Sep 11, 2019 at 12:32
  • Prepending env LC_ALL=C to your command (or exporting that variable) should work as well. Dec 15, 2020 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .