mrid
mrid

Reputation: 5796

Error while installing mongodb on ubuntu 16.04

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

Upvotes: 12

Views: 21461

Answers (11)

Parth Parekh
Parth Parekh

Reputation: 119

I was facing the same issue. I tried to install using brew but it didin't work for me. I followed all the steps mentioned on the official website, but it didn't work.

Error in installing mongodb

I created a specific sources.list file for MongoDB and added to the sources.list directory which is always used by apt. Make sure you use the same format as sources.list

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

Next, we need to update to make apt use updated sources.list. So I used update command.

sudo apt-get update

Finally, I executed the installation command and it worked.

Solution of the error

Upvotes: 1

Dhivya Anbu
Dhivya Anbu

Reputation: 1

Remove those files by using this command.

sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-mongos_4.4.4_amd64.deb; sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-server_4.4.4_amd64.deb; sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-tools;

and then run

sudo apt-get install -y mongodb-org;

sudo systemctl start mongod;

Upvotes: 0

Mithilesh Jha
Mithilesh Jha

Reputation: 175

For installing mongodb 4.0 in ubuntu 16.04


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

sudo apt install libcurl3

sudo apt-get update

sudo service mongod start

mongo

Upvotes: 0

don collins
don collins

Reputation: 21

  • 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

Upvotes: 2

HZ-VUW
HZ-VUW

Reputation: 982

I have tried many answers, but at last, I found that make system version is not matched to the mongo repo required version. At MongoDB official website, there is an option to let you choose the correct repo link. So, check your system version firstly with:

lsb_release -dc

Then if your system version is 18.04, try

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

If your system version is 16.04, try

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

Upvotes: 1

KNDheeraj
KNDheeraj

Reputation: 852

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.

Upvotes: 11

takasoft
takasoft

Reputation: 1278

Worked after installing libcurl3

sudo apt install libcurl3

Upvotes: 16

Soumyaansh
Soumyaansh

Reputation: 8978

Run the below command:

sudo apt-get -f install

And then try running sudo apt-get install -y mongodb-org

Upvotes: 2

Girish Bhasin
Girish Bhasin

Reputation: 29

 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

Upvotes: 2

FELASNIPER
FELASNIPER

Reputation: 337

Have you checked inodes on the server? df -h may still show space left but you could be out of inodes. Please try running df -i and see if you have any inodes left on the server.

Upvotes: 0

Ognjen Vukovic
Ognjen Vukovic

Reputation: 531

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.

Upvotes: 2

Related Questions