15

I'm trying to reinstall it, because it has problems. For example, I can't install Chromium because mongodb-org-server is not configured. But I can't even remove it for the same reason.

apt-get autoremove --purge mongodb

Or:

apt-get purge mongodb

Or:

apt-get remove --purge mongodb

All end in the same way:

 dpkg: error processing package mongodb-org-server (--configure):
  subprocess installed post-installation script returned error exit status 102
 Errors were encountered while processing:
  mongodb-org-server
 E: Sub-process /usr/bin/dpkg returned an error code (1)

Some data about my machine from hostnamectl:

  Operating System: Debian GNU/Linux 8 (jessie)
  Kernel: Linux 3.14-2-amd64
  Architecture: x86_64

How can I fix this?

Updates: things I tried/I'm trying

apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 973 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mongodb-org-server (3.0.2) ...
dpkg: error processing package mongodb-org-server (--configure):
 subprocess installed post-installation script returned error exit status 102
Errors were encountered while processing:
 mongodb-org-server
user2502368
  • 467
  • 1
  • 4
  • 16
  • There were broken dependencies during a previous install. Try `apt-get install -f` or `dpkg --configure -a` – marekful Jun 07 '15 at 08:50
  • Thanks for the answer. The problem seems to be deeper than that (a lot of people are having issues with mongodb + debian). The first command gives the same error, the second has no output. – user2502368 Jun 07 '15 at 08:58
  • 973 not upgraded? It seems you had dist-upgrade that didn't finish? – marekful Jun 07 '15 at 09:16
  • 2
    what is `mongodb-org-server`? there is [no such package in Debian](https://packages.debian.org/search?keywords=mongodb-org-server&searchon=names&suite=all&section=all&sourceid=mozilla-search). It seems to have a broken `post-remove` script. – umläute Jun 07 '15 at 21:20

2 Answers2

36

To avoid that sort of problems you should install software only from native Debian repositories. Unfortunately it is not unusual when sloppy/incompetent 3rd party packages are responsible for such troubles.

To recover try removing file /var/lib/dpkg/info/mongodb-org-server.postinst before attempting to apt-get purge mongodb.

Onlyjob
  • 5,692
  • 2
  • 35
  • 35
  • 35
    Thanks a lot. This almost helped. My problem: I've ran into dir: `cd /var/lib/dpkg/info/`, checked what I have on mongo `ls | grep mongo`, and remove all mongo files `rm mongo*`. After I've ran `apt-get purge mongodb` and I got success. – Lazyexpert Nov 30 '15 at 11:50
  • 4
    Above comment should be the question answer imo. – Matt Cavanagh Jul 04 '16 at 19:32
  • This is so frustrating. I was stuck on uninstall problem for so long & luckily found this answer. It worked like charm. Though my return status code was 5. Does this mean anything? – harshad May 27 '17 at 07:36
  • Lazyexpert's comment also was the key for me. The main lesson I learned here is that MongoDB is pain and their website gives crap advice. – Stonecraft Nov 14 '18 at 20:03
  • In my case, it was really similar but the file to remove was `/var/lib/dpkg/info/mongodb-org-server.prerm` – Moacir Rosa Apr 07 '19 at 01:03
7

Remove all mongodb file inside

/var/lib/dpkg/info/mongodb

And then do

sudo apt purge mongodb-org*

Answer credits to: Lazyexpert