CentOS 6在进行yum update后出现如下错误,

Error in POSTIN scriptlet in rpm package libstdc++-4.4.7-23.el6.x86_64
error: Couldn't fork %post(libstdc++-4.4.7-23.el6.x86_64): Cannot allocate memory
  Updating   : pcre-7.8-7.el6.x86_64                                                                                                                                                                                                     5/239
Error in POSTIN scriptlet in rpm package pcre-7.8-7.el6.x86_64
error: Couldn't fork %post(pcre-7.8-7.el6.x86_64): Cannot allocate memory
  Updating   : grep-2.20-6.el6.x86_64                                                                                                                                                                                                    6/239
Error in POSTIN scriptlet in rpm package grep-2.20-6.el6.x86_64
error: Couldn't fork %post(grep-2.20-6.el6.x86_64): Cannot allocate memory
  Updating   : cpio-2.10-13.el6.x86_64                                                                                                                                                                                                   7/239
Error in POSTIN scriptlet in rpm package cpio-2.10-13.el6.x86_64
error: Couldn't fork %post(cpio-2.10-13.el6.x86_64): Cannot allocate memory
  Updating   : sysvinit-tools-2.87-6.dsf.el6.x86_64                                                                                                                                                                                      8/239
  Updating   : tcp_wrappers-libs-7.6-58.el6.x86_64                                                                                                                                                                                       9/239
Error in POSTIN scriptlet in rpm package tcp_wrappers-libs-7.6-58.el6.x86_64
error: Couldn't fork %post(tcp_wrappers-libs-7.6-58.el6.x86_64): Cannot allocate memory
  Updating   : 1:findutils-4.4.2-9.el6.x86_64                                                                                                                                                                                           10/239
Error in POSTIN scriptlet in rpm package 1:findutils-4.4.2-9.el6.x86_64
error: Couldn't fork %post(findutils-1:4.4.2-9.el6.x86_64): Cannot allocate memory
  Updating   : sqlite-3.6.20-1.el6_7.2.x86_64                                                                                                                                                                                           11/239
Error in POSTIN scriptlet in rpm package sqlite-3.6.20-1.el6_7.2.x86_64
error: Couldn't fork %post(sqlite-3.6.20-1.el6_7.2.x86_64): Cannot allocate memory
  Updating   : nss-softokn-3.14.3-23.3.el6_8.x86_64                                                                                                                                                                                     12/239
Error in POSTIN scriptlet in rpm package nss-softokn-3.14.3-23.3.el6_8.x86_64
error: Couldn't fork %post(nss-softokn-3.14.3-23.3.el6_8.x86_64): Cannot allocate memory
  Updating   : libtasn1-2.3-6.el6_5.x86_64                                                                                                                                                                                              13/239
Error in POSTIN scriptlet in rpm package libtasn1-2.3-6.el6_5.x86_64
error: Couldn't fork %post(libtasn1-2.3-6.el6_5.x86_64): Cannot allocate memory
  Updating   : p11-kit-0.18.5-2.el6_5.2.x86_64                                                                                                                                                                                          14/239
Error in POSTIN scriptlet in rpm package p11-kit-0.18.5-2.el6_5.2.x86_64
error: Couldn't fork %post(p11-kit-0.18.5-2.el6_5.2.x86_64): Cannot allocate memory
  Updating   : p11-kit-trust-0.18.5-2.el6_5.2.x86_64                                                                                                                                                                                    15/239
Error in POSTIN scriptlet in rpm package p11-kit-trust-0.18.5-2.el6_5.2.x86_64
error: Couldn't fork %post(p11-kit-trust-0.18.5-2.el6_5.2.x86_64): Cannot allocate memory
  Updating   : less-436-13.el6.x86_64                                                                                                                                                                                                   16/239
  Updating   : gmp-4.3.1-13.el6.x86_64                                                                                                                                                                                                  17/239
Error in POSTIN scriptlet in rpm package gmp-4.3.1-13.el6.x86_64
error: Couldn't fork %post(gmp-4.3.1-13.el6.x86_64): Cannot allocate memory
  Updating   : device-mapper-persistent-data-0.6.2-0.2.rc7.el6.x86_64                                                                                                                                                                   18/239
  Updating   : 1:make-3.81-23.el6.x86_64                                                                                                                                                                                                19/239
Error in POSTIN scriptlet in rpm package 1:make-3.81-23.el6.x86_64
error: Couldn't fork %post(make-1:3.81-23.el6.x86_64): Cannot allocate memory
  Updating   : gdbm-1.8.0-39.el6.x86_64                                                                                                                                                                                                 20/239
Error in POSTIN scriptlet in rpm package gdbm-1.8.0-39.el6.x86_64
error: Couldn't fork %post(gdbm-1.8.0-39.el6.x86_64): Cannot allocate memory
  Updating   : plymouth-core-libs-0.8.3-29.el6.centos.x86_64                                                                                                                                                                            21/239
Segmentation fault

找了一圈后,找到结局方案,具体如下:
编辑 /etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效

vi /etc/sysctl.conf

修改/添加

vm.overcommit_memory=1

Esc 退出 :wq 保存
然后sysctl -p 使配置文件生效