After installing elementary OS, I went through the installation procedure for mongodb community server on https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/, but when I am trying to install the package mongodb-org using sudo apt-get install -y mongodb-org (or even the unofficial package, mongodb), then it's throwing the following error :

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-shell but it is not going to be installed
               Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
E: Unable to correct problems, you have held broken packages`

I even tried to installing it using a .DEB file, but it's throwing the same error. I have also tried apt --fix-broken install & sudo apt -f install. If this issue is not resolved then I might as well change change the OS.

1 Answer 1


You may have to remove the existing mongodb package from Ubuntu entirely. According to this AskUbuntu answer, completely remove the existing installation from Ubuntu's repository.

$ sudo apt-get purge mongodb mongodb-server mongodb-server-core mongodb-clients
$ sudo apt-get purge mongodb-org
$ sudo apt-get autoremove

Then install the community edition.

$ sudo apt-get update
$ sudo apt-get install mongodb-org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.