7

So, I tried to install mongo on my local machine, a Ubuntu 18.04.

The installation came to a halt with an error

The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-server but it is not installed
              Depends: mongodb-org-mongos but it is not installed
              Depends: mongodb-org-tools but it is not installed

[edit] I don't have the original error from the installation. However, if any of you need anything that can help, just let me know

I tried to run 'apt --fix-broken install' and it gives me

(Reading database ... 207088 files and directories currently installed.)
Preparing to unpack .../mongodb-org-server_3.6.6_amd64.deb ...
Unpacking mongodb-org-server (3.6.6) ...
**dpkg**: error processing archive /var/cache/apt/archives/mongodb-org-server_3.6.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1
**dpkg-deb**: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_3.6.6_amd64.deb ...
Unpacking mongodb-org-mongos (3.6.6) ...
**dpkg**: error processing archive /var/cache/apt/archives/mongodb-org-mongos_3.6.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1
**dpkg-deb**: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-tools_3.6.6_amd64.deb ...
Unpacking mongodb-org-tools (3.6.6) ...
**dpkg**: error processing archive /var/cache/apt/archives/mongodb-org-tools_3.6.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
**dpkg-deb**: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_3.6.6_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_3.6.6_amd64.deb
/var/cache/apt/archives/mongodb-org-tools_3.6.6_amd64.deb

Then I tried to 'apt-get install -f' and it returns the same error as it did on --fix-broken. Tried to purge mongodb, tried to delete repositories, edited source list to work with 16.04, tried apt remove, tried apt autoremove.

I'm running out of options. Can anyone help me?

[edit]

Source list goes as follows:

# deb cdrom:[Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20180105.1)]/ artful main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://br.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://br.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://br.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful universe
deb http://br.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://br.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful multiverse
deb http://br.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ artful-updates multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu artful partner
# deb-src http://archive.canonical.com/ubuntu artful partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu artful-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu artful-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu artful-security multiverse
deb http://archive.ubuntu.com/ubuntu bionic universe
# deb-src http://archive.ubuntu.com/ubuntu artful universe
deb http://repository.spotify.com stable non-free
# deb-src http://repository.spotify.com stable non-free
# deb-src http://repository.spotify.com stable non-free

[edit2]

Tried sudo apt-get purge mongodb mongodb-server mongodb-server-core mongodb-clients and it returns this

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'mongodb' is not installed, so not removed
Package 'mongodb-clients' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-server but it is not going to be installed
            Depends: mongodb-org-mongos but it is not going to be installed
            Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • 1
    Please edit your question to show complete output. The summaries are much less helpful. You have edited away the actual error messages. – user535733 Jul 11 '18 at 18:06
  • Are you trying to use mongodb repo for 16.04 for Ubuntu 18.04 installation? – Bernard Wei Jul 11 '18 at 18:20
  • @BernardWei it was a test to see if something happened – Caio Favero Jul 11 '18 at 19:09
  • @user535733 done. Hope it helps – Caio Favero Jul 11 '18 at 19:24
18

From the logs, looks like you have mongodb installed from Ubuntu 18.04 and then you modify the repo to add the one from mongodb. Try removing the mongodb from Ubuntu repo first before installing the one from mongodb repo.

Ubuntu came with mongodb version 3.6.3 and it is already installed. Remove it first.

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

Then try installing again

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

Edited, problem purging...

Try forcefully removing the two offending packages individually.

sudo dpkg --remove --force-remove-reinstreq mongo-tools
sudo dpkg --remove --force-remove-reinstreq mongodb-server-core

After that you can this again,

sudo apt-get --fix-broken install
  • Doesn't work. I edited the question with the response – Caio Favero Jul 11 '18 at 20:42
  • 1
    Added steps to forcefully removing the two offending packages. – Bernard Wei Jul 11 '18 at 20:56
  • +1 for forcefully removing – Dan Jan 25 at 9:31
1

I used apt remove mongodb-org, which successfully cleaned the broken dependencies and it immediately returned to normal

Thanks all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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