以 root 身份运行时,mongodb 2.4.9 在 wheezy 上崩溃

以 root 身份运行时,mongodb 2.4.9 在 wheezy 上崩溃

我在 Debian Wheezy 上安装了 mongodb-10gen v2.4.9,但出现了一个非常奇怪的现象:如果我以 root 身份运行它,它无法启动:

root@xx:~# /etc/init.d/mongodb stop
[ ok ] Stopping database: mongodb.
root@xx:~# /etc/init.d/mongodb start
[FAIL] Starting database: mongodb failed! 

如果我手动运行它,我会看到它崩溃:

root@xx:~# /usr/bin/mongod --config /etc/mongodb.conf
Sat Mar  8 12:26:30.276 terminate() called, printing stack (if implemented for platform):
0xde46e1 0x6cf54e 0x7f28ae0fa996 0x7f28ae0fa9c3 0x7f28ae0fabee 0x7f28ae14c77d 0x7f28ae117814 0x7f28ae10c744 0x7f28ae10d77d 0xe01f3f 0xe0288b 0xdff530 0x9f257f 0x6dd820 0x6df5c9 0x7f28ad892ead 0x6cf339
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xde46e1]
 /usr/bin/mongod(_ZN5mongo11myterminateEv+0x3e) [0x6cf54e]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63996) [0x7f28ae0fa996]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x639c3) [0x7f28ae0fa9c3]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63bee) [0x7f28ae0fabee]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt21__throw_runtime_errorPKc+0x5d) [0x7f28ae14c77d]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x80814) [0x7f28ae117814]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt6locale5_ImplC1EPKcm+0x44) [0x7f28ae10c744]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt6localeC1EPKc+0x65d) [0x7f28ae10d77d]
 /usr/bin/mongod(_ZN5boost11filesystem34path21wchar_t_codecvt_facetEv+0x4f) [0xe01f3f]
 /usr/bin/mongod(_ZNK5boost11filesystem34path14root_directoryEv+0xbb) [0xe0288b]
 /usr/bin/mongod(_ZN5boost11filesystem38absoluteERKNS0_4pathES3_+0x40) [0xdff530]
 /usr/bin/mongod(_ZN5mongo27initializeServerGlobalStateEb+0x15f) [0x9f257f]
 /usr/bin/mongod() [0x6dd820]
 /usr/bin/mongod(main+0x9) [0x6df5c9]
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7f28ad892ead]
 /usr/bin/mongod(__gxx_personality_v0+0x499) [0x6cf339]
Sat Mar  8 12:26:30.280 Got signal: 6 (Aborted).

Sat Mar  8 12:26:30.283 Backtrace:
0xde46e1 0x6d06c9 0x7f28ad8a64f0 0x7f28ad8a6475 0x7f28ad8a96f0 0x6cf553 0x7f28ae0fa996 0x7f28ae0fa9c3 0x7f28ae0fabee 0x7f28ae14c77d 0x7f28ae117814 0x7f28ae10c744 0x7f28ae10d77d 0xe01f3f 0xe0288b 0xdff530 0x9f257f 0x6dd820 0x6df5c9 0x7f28ad892ead
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xde46e1]
 /usr/bin/mongod(_ZN5mongo10abruptQuitEi+0x399) [0x6d06c9]
 /lib/x86_64-linux-gnu/libc.so.6(+0x324f0) [0x7f28ad8a64f0]
 /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f28ad8a6475]
 /lib/x86_64-linux-gnu/libc.so.6(abort+0x180) [0x7f28ad8a96f0]
 /usr/bin/mongod(_ZN5mongo11myterminateEv+0x43) [0x6cf553]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63996) [0x7f28ae0fa996]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x639c3) [0x7f28ae0fa9c3]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63bee) [0x7f28ae0fabee]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt21__throw_runtime_errorPKc+0x5d) [0x7f28ae14c77d]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x80814) [0x7f28ae117814]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt6locale5_ImplC1EPKcm+0x44) [0x7f28ae10c744]
 /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt6localeC1EPKc+0x65d) [0x7f28ae10d77d]
 /usr/bin/mongod(_ZN5boost11filesystem34path21wchar_t_codecvt_facetEv+0x4f) [0xe01f3f]
 /usr/bin/mongod(_ZNK5boost11filesystem34path14root_directoryEv+0xbb) [0xe0288b]
 /usr/bin/mongod(_ZN5boost11filesystem38absoluteERKNS0_4pathES3_+0x40) [0xdff530]
 /usr/bin/mongod(_ZN5mongo27initializeServerGlobalStateEb+0x15f) [0x9f257f]
 /usr/bin/mongod() [0x6dd820]
 /usr/bin/mongod(main+0x9) [0x6df5c9]
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7f28ad892ead]

但如果我使用 sudo 运行它,它运行正常:

root@xx:~# su - franck
franck@xx:~$ sudo /etc/init.d/mongodb start
[ ok ] Starting database: mongodb.

有人知道为什么吗?

答案1

显然 root 的区域设置不正确。

locale比较以 运行 时的输出franck与以 运行 时的输出root。您可以通过修改 来修复 root 的语言环境/root/.bashrc

相关内容