Problem Installing Maven on Ubuntu 14.04

Posted December 14, 2015 6.5k views

Steps Taken
sudo apt-get install maven

Unpacking libgraphite2-3:amd64 (1.2.4-1ubuntu1) over (1.2.4-1ubuntu1) …
dpkg: unrecoverable fatal error, aborting:
fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)

Attempted Fix
sudo apt-get update (no change in error)

Other Info
On starting SSH I get the following error
Could not load list of meta packages: [Errno 12] Cannot allocate memory
Could not load list of meta packages: [Errno 12] Cannot allocate memory

On top <enter>
I get KiB Swap:0

FStab contains
UUID=050e1e34-39e6-4072-a03e-ae0bf90ba13a / ext4 errors=remount-ro 0 1
(I have checked the UUID from blkid)

can someone help me out?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

This problem can be caused by multiple things;

  1. The droplet hasn’t got enough RAM resources to run apt-get. This can be cause when you got a very small droplet and use alot of RAM with your applications. You can check your RAM usage with free -m. If this is the issue you need to increase your droplet RAM.
  2. The droplet has a some process that is leaking memory. To get an idea of which process this might be, run
ps --sort -rss -eo rss,pid,command | head

Also check the following items:

Display swap usage summary

swapon -s

Display user-process resource limits

ulimit -a

With this information you can find out what is causing this. Give an output of everything you’ve done to provide you more support.