Saturday, January 11, 2014

YUM: Cannot allocate memory

While trying to execute yum -y install nfs-utils nfs-utils-lib for the installation of NFS on a test EC2 micro instance running CentOS, I got the following error:



Total                                                                                                              1.6 MB/s | 644 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : libgssglue-0.1-11.el6.i686                                                                                                      1/7
Error in POSTIN scriptlet in rpm package libgssglue-0.1-11.el6.i686
error: Couldn't fork %post(libgssglue-0.1-11.el6.i686): Cannot allocate memory
  Installing : libtirpc-0.2.1-6.el6_4.i686                                                                                                     2/7
Error in POSTIN scriptlet in rpm package libtirpc-0.2.1-6.el6_4.i686
error: Couldn't fork %post(libtirpc-0.2.1-6.el6_4.i686): Cannot allocate memory
Error in PREIN scriptlet in rpm package rpcbind-0.2.0-11.el6.i686
error: Couldn't fork %pre(rpcbind-0.2.0-11.el6.i686): Cannot allocate memory
error:   install: %pre scriptlet failed (2), skipping rpcbind-0.2.0-11.el6
  Installing : libevent-1.4.13-4.el6.i686                                                                                                      4/7
Error in POSTIN scriptlet in rpm package libevent-1.4.13-4.el6.i686
error: Couldn't fork %post(libevent-1.4.13-4.el6.i686): Cannot allocate memory
  Installing : keyutils-1.4-4.el6.i686                                                                                                         5/7
  Installing : nfs-utils-lib-1.1.5-6.el6.i686                                                                                                  6/7
Error in POSTIN scriptlet in rpm package nfs-utils-lib-1.1.5-6.el6.i686
error: Couldn't fork %post(nfs-utils-lib-1.1.5-6.el6.i686): Cannot allocate memory
Error in PREIN scriptlet in rpm package 1:nfs-utils-1.2.3-39.el6.i686
error: Couldn't fork %pre(nfs-utils-1:1.2.3-39.el6.i686): Cannot allocate memory
error:   install: %pre scriptlet failed (2), skipping nfs-utils-1:1.2.3-39.el6
  Verifying  : keyutils-1.4-4.el6.i686                                                                                                         1/7
  Verifying  : rpcbind-0.2.0-11.el6.i686                                                                                                       2/7
  Verifying  : libgssglue-0.1-11.el6.i686                                                                                                      3/7
  Verifying  : 1:nfs-utils-1.2.3-39.el6.i686                                                                                                   4/7
  Verifying  : nfs-utils-lib-1.1.5-6.el6.i686                                                                                                  5/7
  Verifying  : libevent-1.4.13-4.el6.i686                                                                                                      6/7
  Verifying  : libtirpc-0.2.1-6.el6_4.i686                                                                                                     7/7

Dependency Installed:
  keyutils.i686 0:1.4-4.el6                                                                                                                       

Failed:
  libevent.i686 0:1.4.13-4.el6           libgssglue.i686 0:0.1-11.el6       libtirpc.i686 0:0.2.1-6.el6_4       nfs-utils.i686 1:1.2.3-39.el6     
  nfs-utils-lib.i686 0:1.1.5-6.el6       rpcbind.i686 0:0.2.0-11.el6      

Complete!
The error was exactly that: the VM did not have enough memory due to the already running Apache, MySQL and Tomcat services I had running on VM with only 613MB of RAM.

Killing Tomcat freed up enough memory to allow the command succeed.