Can't reinstall MongoDB on Ubuntu 17

17,205

You can force installation of package:

sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb

Then resume with:

sudo apt-get install -f
Share:
17,205

Related videos on Youtube

GD- Ganesh Deshmukh
Author by

GD- Ganesh Deshmukh

These questions/answers on StackOverflow were done in last year, during college time, now I have improved a lot than last year. Backend Developer at Jio-Haptik. My Portfolio's Link: https://ganeshdeshmukh.me

Updated on September 18, 2022

Comments

  • GD- Ganesh Deshmukh
    GD- Ganesh Deshmukh over 1 year

    I uninstalled before MongoDB but now I can't install it due to this error:

    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe).
    

    I ran this command -> sudo apt-get install -y mongodb-org

    My terminal output is following:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    libboost-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4
    libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 linux-headers-4.13.0-16
    linux-headers-4.13.0-16-generic linux-headers-4.13.0-21
    linux-headers-4.13.0-21-generic linux-image-4.13.0-16-generic
    linux-image-4.13.0-21-generic linux-image-extra-4.13.0-16-generic
    linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-16-generic
    linux-signed-image-4.13.0-21-generic mongo-tools
    Use 'sudo apt autoremove' to remove them.
    The following additional packages will be installed:
    mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
    The following NEW packages will be installed:
    mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
    mongodb-org-tools
    0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/66.8 MB of archives.
    After this operation, 276 MB of additional disk space will be used.
    Selecting previously unselected package mongodb-org-shell.
    (Reading database ... 316734 files and directories currently installed.)
    Preparing to unpack .../mongodb-org-shell_3.6.2_amd64.deb ...
    Unpacking mongodb-org-shell (3.6.2) ...
    Selecting previously unselected package mongodb-org-server.
    Preparing to unpack .../mongodb-org-server_3.6.2_amd64.deb ...
    Unpacking mongodb-org-server (3.6.2) ...
    Selecting previously unselected package mongodb-org-mongos.
    Preparing to unpack .../mongodb-org-mongos_3.6.2_amd64.deb ...
    Unpacking mongodb-org-mongos (3.6.2) ...
    Preparing to unpack .../mongodb-org-tools_3.6.2_amd64.deb ...
    Unpacking mongodb-org-tools (3.6.2) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb (--unpack):
    trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.2.11-1
    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Selecting previously unselected package mongodb-org.
    Preparing to unpack .../mongodb-org_3.6.2_amd64.deb ...
    Unpacking mongodb-org (3.6.2) ...
    Errors were encountered while processing:
    /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    After running apt --fix-broken install, the output is as follows:

    apt --fix-broken install
    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-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4 libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 linux-headers-4.13.0-16
      linux-headers-4.13.0-16-generic linux-headers-4.13.0-21 linux-headers-4.13.0-21-generic linux-image-4.13.0-16-generic
      linux-image-4.13.0-21-generic linux-image-extra-4.13.0-16-generic linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-16-generic
      linux-signed-image-4.13.0-21-generic mongo-tools
    Use 'apt autoremove' to remove them.
    The following additional packages will be installed:
      mongodb-org-tools
    The following NEW packages will be installed:
      mongodb-org-tools
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    4 not fully installed or removed.
    Need to get 0 B/34.9 MB of archives.
    After this operation, 150 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    (Reading database ... 316761 files and directories currently installed.)
    Preparing to unpack .../mongodb-org-tools_3.6.2_amd64.deb ...
    Unpacking mongodb-org-tools (3.6.2) ...
    dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.2.11-1
    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Errors were encountered while processing:
     /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
  • GD- Ganesh Deshmukh
    GD- Ganesh Deshmukh over 6 years
    thanks N0rbert, it worked. I executed your command and simply added one file in /lib/systemd/system/mongod.service. after restart it started mongodb
  • GD- Ganesh Deshmukh
    GD- Ganesh Deshmukh over 6 years
    now I have successfully installed mongodb-org, but when I started it then problem occurs again. mongodb shell is working fine but when i entered the command as sudo systemctl enable mongod , it gives output as Failed to enable unit: Unit file mongod.service does not exist. @N0rbert
  • N0rbert
    N0rbert over 6 years
    I do not know how to fix this. Try to read official documentation or switch to version from official repository.
  • allexiusw
    allexiusw about 3 years
    It solved my problem thank you so much.