Error while installing mongodb on ubuntu 16.04

20,069

Solution 1

Worked after installing libcurl3

sudo apt install libcurl3

Solution 2

I also had the similar issue and it got resolved for me by doing this Go to this directory /etc/apt/sources.list.d/ and check if there are anyother mongodb-org-*.list files as it would cause conflicts.

then try to install it again, if again issue arises, then run

sudo apt purge mongod* sudo apt purge mongodb* sudo apt purge mongodb-org*

to remove any inconsistency and then go to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ and follow the procedure.

If you're some kind of Ubuntu Derivatives like Linux Mint, Ubuntu GNOME etc, make sure which Ubuntu version is running on your ubuntu derivative version on wiki before pasting the required commands. As in my case I'm using Linux Mint 17 -> Ubuntu 14.04 and I was installing with Ubuntu 16.04 that made the conflict

Hope this would resolve the issue.

Solution 3

 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
mongo

Solution 4

Have you done the update?

sudo apt-get update && sudo apt-get upgrade

If the update does not help, try checking for broken dependencies:

sudo apt-get check

The check command is a diagnostic tool. It used to update package cache and checks for broken dependencies.

I would also try two more things. First,

sudo dpkg --configure -a
sudo apt-get -f install

and if that does not help, try to unblock the dpkg

sudo rm -rf /var/lib/apt/lists/partial/*
sudo apt-get -f install

I hope it helps.

Solution 5

  • Download the MongoDB Community Server (.dbz) version

  • Extract it and move it to home directory

  • Edit the ~/.profile by running:

    • gedit ~/.profile
  • Then add this:

    • echo export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH
  • Save then update the system variables by running:

    • source ~/.profile
  • After that, start server by running:

    • mongod
Share:
20,069
mrid
Author by

mrid

I mostly code in C#, PHP, Javascript, Java ( android ) I've also worked on VB6, and Python Some of my projects: Detecting Backdoors in Windows Processes autocomplete-lite-img sel2tag csv2vcf

Updated on April 21, 2021

Comments

  • mrid
    mrid about 3 years

    I've already seen these answers, so please don't link em in solutions:

    Installing MongoDB on Ubuntu 16.04 https://unix.stackexchange.com/questions/220467/mongodb-unmet-dependencies/220483 can't install mongodb on ubuntu 16.10 https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

    I have already added the required repository for ubuntu 16.04

    When I run sudo apt-get install -y mongodb-org, it throws the error:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
    linux-headers-4.4.0-93-generic : Depends: linux-headers-4.4.0-93 but it is not going to be installed
    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
                   Depends: mongodb-org-tools but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
    

    And on running apt-get -f install, I get the following error:

    Unpacking linux-headers-4.4.0-93 (4.4.0-93.116) ...
    dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-93_4.4.0-93.116_all.deb (--unpack):
    unable to create '/usr/src/linux-headers-4.4.0-93/arch/xtensa/include/asm/pgtable.h.dpkg-new' (while processing './usr/src/linux-headers-4.4.0-93/arch/xtensa/include/asm/pgtable.h'): No space left on device
    No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Errors were encountered while processing:
    /var/cache/apt/archives/linux-headers-4.4.0-93_4.4.0-93.116_all.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    And the same thing continues when I try to install it again.

    Can anyone explain what's this error and how to install it ?

    Update:

    Running df -h gives:

    Filesystem      Size  Used Avail Use% Mounted on
    udev            487M     0  487M   0% /dev
    tmpfs           100M   12M   88M  12% /run
    /dev/xvda1      7.8G  5.3G  2.1G  72% /
    tmpfs           496M     0  496M   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           496M     0  496M   0% /sys/fs/cgroup
    tmpfs           100M     0  100M   0% /run/user/1000
    

    Running df -i gives:

    Filesystem     Inodes  IUsed  IFree IUse% Mounted on
    udev           124466    360 124106    1% /dev
    tmpfs          126788    480 126308    1% /run
    /dev/xvda1     524288 520744   3544  100% /
    tmpfs          126788      1 126787    1% /dev/shm
    tmpfs          126788      6 126782    1% /run/lock
    tmpfs          126788     16 126772    1% /sys/fs/cgroup
    tmpfs          126794      4 126790    1% /run/user/1000
    
  • mrid
    mrid over 6 years
    it says You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: linux-headers-4.4.0-93-generic : Depends: linux-headers-4.4.0-93 but it is not installed
  • Ognjen Vukovic
    Ognjen Vukovic over 6 years
    Sorry, but I have to ask the obvious - do you have enough space on the device? Because it does say: No space left on device No apport report written because the error message indicates a disk full error
  • mrid
    mrid over 6 years
    upgrade gives the same error . check the updated question. I've added the result of df -h command.
  • Ognjen Vukovic
    Ognjen Vukovic over 6 years
    I have updated the comment with two more things to try.
  • mrid
    mrid over 6 years
    thanks, i've updated my question and added the output of df -i as well. can you please chack it and let me know if there's a prob:)
  • Chong Lip Phang
    Chong Lip Phang about 5 years
    purging helped!
  • ZF007
    ZF007 almost 5 years
    the yellow textbox is for error, etc. Use ... for pointing out code to execute. See my modification with the first scriptcode to execute. Now its confusing to us. (From Review).