2

我正在尝试在 Linux 中安装东西(Crunchbang Linux - Debian 的衍生版本),但我遇到了指向 mongodb-20gen 的错误。

当我尝试使用以下方法删除它时:-

cometbill@Linuxn00b:~$ sudo apt-get remove mongodb-10gen

我得到...

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  mongodb-10gen
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 221 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 81657 files and directories currently installed.)
Removing mongodb-10gen ...
arg: remove
invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
dpkg: error processing mongodb-10gen (--remove):
 subprocess installed pre-removal script returned error exit status 100
invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
 mongodb-10gen
E: Sub-process /usr/bin/dpkg returned an error code (1)

我在这里阅读了一些关于 MongoDB 的类似错误的内容,它建议删除 mongo-clients,所以,我尝试了:-

cometbill@Linuxn00b:~$ sudo apt-get remove mongodb-clients

并得到: -

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mongodb-clients' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mongodb-10gen (2.4.6) ...
invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
dpkg: error processing mongodb-10gen (--configure):
 subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
 mongodb-10gen
E: Sub-process /usr/bin/dpkg returned an error code (1)
4

6 回答 6

8

这是一个很难摆脱的状态。如果您创建一个虚假的初始化脚本,您应该能够完成删除:

sudo touch /etc/init.d/mongodb
sudo chmod 755 /etc/init.d/mongodb
于 2013-09-10T23:42:42.297 回答
3

这是由于包管理器 dpkg 本身的一些损坏,来自 Ask Ubuntu 的这个线程:https ://askubuntu.com/questions/195950/package-system-broken-e-sub-process-usr-bin-dpkg-returned -an-error-code-1列出了一些解决方案,更具体地说,状态文件的编辑已被记录为始终有效的解决方案。

于 2013-09-10T22:41:29.333 回答
2

对于mongodb v3.4

sudo touch /etc/init.d/mongod
sudo chmod 755 /etc/init.d/mongod
于 2017-03-13T08:44:40.477 回答
1

您可以强制安装软件包:

sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-tools_3.6.5_amd64.deb

然后继续:

sudo apt-get install -f
于 2018-06-21T04:12:36.903 回答
1

sudo nano /var/lib/dpkg/statoverride

然后删除前 2 行条目并重试

**mongodb mongodb 755 /var/log/mongodb
mongodb mongodb 755 /var/lib/mongodb**
root crontab 2755 /usr/bin/crontab
root mlocate 2755 /usr/bin/mlocate
root ssl-cert 710 /etc/ssl/private
root messagebus 4754 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
于 2019-03-12T14:40:01.743 回答
0

根据您的问题,此过程将在线中断。

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

您必须创建假文件,

sudo touch /etc/init.d/mongodb
sudo chmod 755 /etc/init.d/mongodb

并且过程将完成。

于 2017-01-06T07:44:56.500 回答