MongoDB mongorestore failure: locale::facet::_S_create_c_locale name not valid

Luca Anceschi picture Luca Anceschi · Sep 30, 2013 · Viewed 76.9k times · Source

I created a dump with mongodump on computer A (ubuntu 12.04 server). I moved it to computer B (ubuntu 12.04 server) and typed:

mongorestore -db db_name --drop db_dump_path

It failed and it reported:

connected to: 127.0.0.1
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted

I've successfully accomplished this operation before and this strange behavior has never occurred. What do I need to do to fix this?

Answer

keisar picture keisar · Nov 11, 2013

On my distro "locale-gen" was not installed and it turned out all I had to do is set the LC_ALL environment variable. so the following command fixed it:

export LC_ALL="en_US.UTF-8"

hopefully it will help someone else...