2

I am trying to install MongoDB on Ubuntu 19.04 from the official website. But facing errors

I am following the exact same procedure as written on the official docs, although I am well aware of the fact that my Ubuntu version is not LTS.

All the steps goes good till the final step of installing the MongoDB command. You can see the error here.

vks@247:~$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
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).

I also tried the command: apt --fix-broken install, but it didn't work and shows this:

vks@247:~$ sudo apt --fix-broken install
[sudo] password for vks: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libboost-program-options1.67.0 libgoogle-perftools4 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-server-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-tools
The following NEW packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-tools
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/85.7 MB of archives.
After this operation, 248 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 217305 files and directories currently installed.)
Preparing to unpack .../mongodb-org-server_4.2.5_amd64.deb ...
Unpacking mongodb-org-server (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.2.5_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.2.5_amd64.deb ...
Unpacking mongodb-org-mongos (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-tools_4.2.5_amd64.deb ...
Unpacking mongodb-org-tools (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_4.2.5_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_4.2.5_amd64.deb
 /var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb
 /var/cache/apt/archives/mongodb-org-tools_4.2.5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

After this, I tried to install a specified version as well (although it was the same version).

vks@247:~$ sudo apt-get install -y mongodb-org=4.2.5 mongodb-org-server=4.2.5 mongodb-org-shell=4.2.5 mongodb-org-mongos=4.2.5 mongodb-org-tools=4.2.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libboost-program-options1.67.0 libgoogle-perftools4 libtcmalloc-minimal4
  libyaml-cpp0.6 mongo-tools mongodb-server-core
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-tools
The following packages will be upgraded:
  mongodb-org mongodb-org-shell
2 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 97.7 MB of archives.
After this operation, 255 MB of additional disk space will be used.
Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-shell amd64 4.2.5 [12.0 MB]
Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-server amd64 4.2.5 [18.5 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-mongos amd64 4.2.5 [10.2 MB]
Get:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-tools amd64 4.2.5 [57.0 MB]
Get:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org amd64 4.2.5 [3,532 B]
Fetched 97.7 MB in 20s (4,836 kB/s)                                            
(Reading database ... 217305 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_4.2.5_amd64.deb ...
Unpacking mongodb-org-shell (4.2.5) over (4.0.17) ...
Preparing to unpack .../mongodb-org-server_4.2.5_amd64.deb ...
Unpacking mongodb-org-server (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.2.5_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.2.5_amd64.deb ...
Unpacking mongodb-org-mongos (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-tools_4.2.5_amd64.deb ...
Unpacking mongodb-org-tools (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_4.2.5_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)
Preparing to unpack .../mongodb-org_4.2.5_amd64.deb ...
Unpacking mongodb-org (4.2.5) over (4.0.17) ...
Errors were encountered while processing:
 /var/cache/apt/archives/mongodb-org-server_4.2.5_amd64.deb
 /var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb
 /var/cache/apt/archives/mongodb-org-tools_4.2.5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Issues remain the same.

I have tried to resolve the issue from various sites as well, but couldn't resolve them. Any help would be very much appreciated.

provks
  • 23

1 Answers1

2

I ran in to the same problem, i put just a bit effort on installation manual and found this reason and steps to resolve.

trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2

This error indicates that the system already had the Ubuntu mongodb package installed prior to installing the official MongoDB Inc. mongodb-org packages. To confirm wheter the host has the Ubuntu mongodb package installed, run the following command in a terminal or shell:

So, you need to remove existing mongodb package and then do a fresh installation. Make sure you take necessary backup before removing the existing installation.

1. Remove partially installed packages of mongodb-org

sudo apt-get purge mongodb-org*

2. Remove existing mongodb package

sudo apt remove mongodb
sudo apt purge mongodb
sudo apt autoremove

3. Re-Install mongodb-org

sudo apt-get install -y mongodb-org

Cheers!!

Reference

Ravi Dhoriya ツ
  • 406
  • 1
  • 6
  • 14