Showing posts with label Release memory in Linux. Show all posts
Showing posts with label Release memory in Linux. Show all posts

Thursday, May 16, 2013

dpkg: unrecoverable fatal error, aborting: Cannot allocate memory

dpkg: unrecoverable fatal error, aborting: fork failed: Cannot allocate memory

It means you do not have enough memory to execute the operation.

The fix is for memory error, if you are getting following error
E: Sub-process /usr/bin/dpkg returned an error code (1)
You should check this post.

Since it is a memory error, try to configure dpkg first.
$ sudo dpkg --configure -a
But if you are still getting the error.

Check the free and used physical memory in megabytes by following command.
$ free -m
It displays the total amount of free and used physical memory and swap space in the system, as well as the buffers and cache consumed by the kernel.


Flush file system buffers by executing :
$ sync
Now try again.

If you are still facing the same problem, follow this.
To free page cache:
$ echo 1 > /proc/sys/vm/drop_caches

To free dentries and i-nodes :
$ echo 2 > /proc/sys/vm/drop_caches

To free page cache, dentries and i-nodes :
$ echo 3 > /proc/sys/vm/drop_caches
Now try again.

Still the error is not fixed, you should check the RAM and SWAP space for your system / server. Assigning a bigger RAM / SWAP will solve the error.