MongoDB installation problems Linux Mint Debian

巧了我就是萌 提交于 2021-02-09 11:12:49

问题


MongoDB did not install correctly because of some Dpkg errors. Trying to purge or remove anything related just comes with the error. I have tried deleting all of the Mongodb libs and did a search for other files. I am not sure what caused the original error or how to get the system back to a workable state:

Setting up mongodb-org-server (2.6.5) ...
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is the original installation command

$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 115 MB of archives.
After this operation, 290 MB of additional disk space will be used.
Get:1 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-               shell amd64 2.6.5 [4,458 kB]
Get:2 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    server amd64 2.6.5 [9,446 kB]                                                                                   
Get:3 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    mongos amd64 2.6.5 [7,175 kB]                                                                                   
Get:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    tools amd64 2.6.5 [93.7 MB]                                                                                     
Get:5 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org amd64 2.6.5 [3,656 B]                                                                                           
Fetched 115 MB in 4min 20s (441 kB/s)                                                                                                                                                                 
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 165525 files and directories currently installed.)
Unpacking mongodb-org-shell (from .../mongodb-org-shell_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-server.
Unpacking mongodb-org-server (from .../mongodb-org-server_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-mongos.
Unpacking mongodb-org-mongos (from .../mongodb-org-mongos_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-tools.
Unpacking mongodb-org-tools (from .../mongodb-org-tools_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org.
Unpacking mongodb-org (from .../mongodb-org_2.6.5_amd64.deb) ...
Processing triggers for man-db ...
Setting up mongodb-org-shell (2.6.5) ...
Setting up mongodb-org-server (2.6.5) ...
Adding system user `mongodb' (UID 120) ...
Adding new user `mongodb' (UID 120) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 126) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
 subprocess installed post-installation script returned error exit status 100
Setting up mongodb-org-mongos (2.6.5) ...
Setting up mongodb-org-tools (2.6.5) ...
dpkg: dependency problems prevent configuration of mongodb-org:
mongodb-org depends on mongodb-org-server; however:
Package mongodb-org-server is not configured yet.

dpkg: error processing mongodb-org (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mongodb-org-server
 mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)

回答1:


Try using this init script. init.d

If you previously installed MongoDB, uninstall it first.

To delete МongoDB. sudo apt-get remove mongodb-10gen After that delete confing files and init scripts sudo find /etc/ | grep mongod.* | xargs rm -rf sudo find /usr/bin/ | grep mongod.* | xargs rm -rf sudo find /var/lib/ | grep mongod.* | xargs rm -rf

Warning! /var/lib/ may contain your databases.

Install MongoDB




回答2:


There are

apt-get autoremove
apt-get -f install

worthy to try first, if it doesn't work, actually I have mongodb-org-server in half-configure and no regular way to remove. Then I found a worst solution which is to remove package status block. But you will lose track of the real package state and leave trash in your system. So I check the error message we have, and I found this line interesting:

invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.

Then I create a empty file to fool the invoke function.

touch /etc/init.d/mongod

And then try apt-get autoremove again and apt-get remove the package successfully!




回答3:


Run this code

touch /etc/init.d/mongod

and then follow that link https://community.c9.io/t/setting-up-mongodb/1717

Note: (--rest) is removed in latest release of mongo.



来源:https://stackoverflow.com/questions/26369747/mongodb-installation-problems-linux-mint-debian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!