MongoDB errors: mongodb-10gen E: Sub-process /usr/bin/dpkg returned an error code (1)
Solution 1
This is due to some corruption within the package manager dpkg itself, this thread from Ask Ubuntu: https://askubuntu.com/questions/195950/package-system-broken-e-sub-process-usr-bin-dpkg-returned-an-error-code-1 lists some solutions, more specifically the editing of the status file has been noted as one that always works.
Solution 2
This is a difficult state to get out of. You should be able to complete the removal if you create a fake init script:
sudo touch /etc/init.d/mongodb
sudo chmod 755 /etc/init.d/mongodb
Solution 3
For mongodb v3.4
sudo touch /etc/init.d/mongod
sudo chmod 755 /etc/init.d/mongod
Solution 4
sudo nano /var/lib/dpkg/statoverride
Then remove first 2 line entries and try again
**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
Solution 5
You can force installation of package:
sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-tools_3.6.5_amd64.deb
Then resume with:
sudo apt-get install -f
Comments
-
cometbill almost 2 years
I'm trying to install things in Linux (Crunchbang Linux - a derivation of Debian), and I'm getting errors which point towards mongodb-20gen.
When I try to remove it using :-
cometbill@Linuxn00b:~$ sudo apt-get remove mongodb-10gen
I get ...
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)
I read something on here for similar errors with MongoDB, and it suggested removing mongo-clients, so, I tried:-
cometbill@Linuxn00b:~$ sudo apt-get remove mongodb-clients
and get:-
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)