Cannot uninstall MongoDB on Ubuntu! :(

Hi Guys,

Recently I faced the issue of "invoke-rc.d: initscript mongod, action "stop" failed. dpkg: error processing package mongodb-org-server (--remove)" while uninstalling MongoDB version 3.0.14 on Ubuntu version 16.10.

I tried 

  • normal purge/remove option of apt-get
  • Tried reinstalling the package with --reinstall option. 
  • Installing the same version with command sudo apt-get install -y mongodb-org=3.0.14 mongodb-org-server=3.0.14 mongodb-org-shell=3.0.14 mongodb-org-mongos=3.0.14 mongodb-org-tools=3.0.14 & then again removing the package.
But all those tries resulted in "ri" status of command dpkg -l | grep mongodb-org-server. Nothing seem to help me & it resulted in frustration most of us are familiar with.

According to this page, the Ubuntu version I am using doesn't support the MongoDB installation as of writing this blog post. So I had a field day trying to find the solution. So if you're facing similar problem keep on reading! :)

Let me explain you something about the problem.

When we install MongoDB on Ubuntu platform, we need to add Mongo's repository into Ubuntu's sources directory. It's because MongoDB isn't listed in Debian native repository & it's maintained by third party which is MongoDB itself. So the scripts which are written for install/uninstall/upgrade can sometimes give such troubles onto some platforms which are new or not fully tested.

So if you're facing the error I mentioned above & normal apt-get purge/remove options don't seem to work, try removing all mongodb files in directory /var/lib/dpkg/info with following command:
sudo rm /var/llib/dpkg/info/mongodb-*
Then remove the mongodb package with
sudo apt-get purge mongodb-org*
This should remove all the mongodb package files from system.

After that upgrade/install mongodb version of your choice.

Hope this helps you!
Enjoy! :)

Comments

  1. Unable to Install the MongoDB on Ubuntu 16.10? Contact to DB Installation Support
    In the event that you need effectively establishment of MongoDB on Ubuntu 16.10 then you are at right stage. Indeed! We at Cognegic give DB Configuration Support or legitimate Database Management Services for those clients whose are not ready to introduce the MongoDB on Ubuntu 16.10. Our engineers are mastery in establishment and design of any database like: MySQL, MS SQL Server, Cassandra et cetera.
    For More Info: https://cognegicsystems.com/
    Contact Number: 1-800-450-8670
    Email Address- info@cognegicsystems.com
    Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801

    ReplyDelete

Post a Comment