centos 7 cannot allocate memory

January 30, 2015 16k views

try to yum install php56w-mcrypt and system gave me this error

  libmcrypt-2.5.8-13.el7.x86_64: [Errno 5] [Errno 12] Cannot allocate memory
  php56w-mcrypt-5.6.5-1.w7.x86_64: [Errno 5] [Errno 12] Cannot allocate memory

I ran a check on free -m

             total       used       free     shared    buffers     cached
Mem:           490        421         68          8          3         42
-/+ buffers/cache:        376        113
Swap:            0          0          0

and top

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 9756 mysql     20   0  727588  81556      0 S  0.3 16.2   1:04.61 mysqld
11089 root      20   0       0      0      0 S  0.3  0.0   0:16.25 kworker/0:2
    1 root      20   0  129396   2020    576 S  0.0  0.4   0:05.88 systemd
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd
    3 root      20   0       0      0      0 S  0.0  0.0   0:00.16 ksoftirqd/0
    5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H
    7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0
    8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh
    9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0
   10 root      20   0       0      0      0 S  0.0  0.0   0:01.82 rcu_sched
   11 root      20   0       0      0      0 R  0.0  0.0   0:02.10 rcuos/0
   12 root      rt   0       0      0      0 S  0.0  0.0   0:00.91 watchdog/0
   13 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 khelper
   14 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs
   15 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns
   16 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback
   17 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd

not sure where else to check.

Am using DigitalOcean VPS with RAM 512MB, the $5/month plan

2 Answers

As you can see, you only have 113mb free, which is all used by yum when you run it.

I had the same issue and since mine is not a production server I just stopped Apache and MariaDB, ran the updates then started them backup.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!