当前位置: 首页>>技术教程>>正文


全局初始化失败:BadValue无效或未设置用户区域设置。请确保正确设置LANG和/或LC_ *环境变量

, ,

问题描述

我在生成服务于赫伯特和荷马的地区时遇到问题。我运行mongo我得到警告

Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.

当我跑步

dpkg-reconfigure locales

mongo启动成功,然后重新启动服务器并运行mongo时,我也遇到了同样的问题。

谢谢帮忙

最佳解决方法

https://askubuntu.com/questions/536875/error-in-installing-mongo-in-virtual-machine

Looks like your locale settings are broken or non-existent on that VM, or at least that session on that VM. One of MongoDB’s dependencies (boost) will fail when a locale is not correctly set (see SERVER-9032). For reference, before the change in SERVER-9032 this problem still happened but looked like this.

Sometimes logging out and back in can fix it (only broken for current session), or you can try running sudo local-gen to make sure generation is successful.

In the meantime, as a workaround to get mongo (or mongod etc.) running, just set your LC_ALL variable manually before starting the program:

export LC_ALL=C
mongo 

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/7468.html,未经允许,请勿转载。