解决centos错误memory alloc () returned NULL和Running Transaction Test Killed的方法

分类:VPS备忘 标签:centos, fdcservers

我在使用fdcservers的256M的vps时遇到一个这样的问题,运行centos5.6,执行yum update遇到这样错误:

Running Transaction Test
memory alloc (bytes) returned NULL

有时候是这样:

Running Transaction Test

Killed

发tk给客服半天没反应,于是Google一下看有没有解决方法。

在网上找到了四师兄的一篇帖子贴了国外网友解决问题的教程如下:

1、《yum fails with memory alloc (8 bytes) returned NULL.》–https://helpdesk.cloudlinux.com/index.php?/Knowledgebase/Article/View/60/0/yum-fails-with-memory-alloc-8-bytes-returned-null

If you are facing issue with yum update or yum install that looks like this:

Total 5.3 MB/s | 23 MB 00:04
Running rpm_check_debug
Running Transaction Test
memory alloc (8 bytes) returned NULL.

The most likely reason — ulimits are limiting amount of virtual memory for the yum process.
To verify that, run:
# ulimit -a

And check max memory size (kbytes, -m) and virtual memory (kbytes, -v). yum might need 1GB or more to process transaction with lots of files. Try running:
# ulimit -m unlimited 
# ulimit -v unlimited

And then re-running yum again




2、《CentOS – yum update problems with low memory boxes》–https://forum.ramhost.us/bbs/viewtopic.php?id=9

Solution
The solution is disabled the Fastest Mirrors plugin, to do that:

vi /etc/yum/pluginconf.d/fastestmirror.conf

You will se something like this:


Code:



[main]
enabled=1
...
...




Then, change the enabled=1 to:


Code:



enabled=0




Save, exit and launch the update command.

I'm not a Linux expert, it took me a while to figure out.
I hope this easy trick can be useful to someone.

 

Another thing that can help is reducing the default stack size to whatever your maximum burst memory is:


Code:


 






# ulimit -s 128




Before running any "yum" command. Running the above command only applies to the current running session (eg: will be lost on a reboot).

Doing this should only be needed on the Nano plan level (if at all).

按照上面的帖子最终还是没有解决问题,于是我试着找到了YUM后软件的所在目录:/var/cache/yum/updates/packages,然后rpm -ivh 安装里面的rpm软件,发现这样就以完成yum update的工作了。

fdc的客服不给力呀!

又发现一个新的方法,描述如下:

memory alloc (12 bytes) returned NULL.


字面意思是内存不足,VPS全新的什么都没跑肯定不是,那只能是母机服务器的问题了,询问了一番高人得出结论:1、联系服务商临时增加。(可行性无限接近于0)2、这是由于升级中filesystem的问题,不过对于VPS来说,filesystem作用不大,主要是看母机的,因此屏蔽即可。

编辑yum的配置文件

# vi /etc/yum.conf


屏蔽掉filesystem,在里面加入

exclude=filesystem


保存退出,重新升级即可。

我没有试,大家试试吧!

 

 
你可能还会对下列文章感兴趣:

0条评论 你不想来一发么↓

    想说点什么呢?

    您需要登录您的Google账号才能进行评论。