Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently having some trouble with yum through sudo. For some reason, it does not seem to work:

aron@graviton [/var/log]# sudo yum clean all
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   /usr/lib64/python2.4/lib-dynload/ failed to map segment from shared object: Cannot allocate memory

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:

The strange thing, however, is that it works fine when I gain root privileges through sudo -i first.

Any ideas what might be causing this problem?

share|improve this question
What does it do with sudo -s instead of sudo -i? – ℝaphink Feb 21 '12 at 13:19
@Raphink sudo -i is not the problem. When executing the command sudo -s yum clean all, the problem persists, though. – Aron Rotteveel Feb 21 '12 at 14:06
@Raphink I deleted my previous comment; I was too quick to assume that the problem was solved. My bad :) – Aron Rotteveel Feb 21 '12 at 14:07
Hehe. By sudo -s, I meant to do sudo -s; yum clean all. Did you try that? – ℝaphink Feb 21 '12 at 14:09
@Raphink yes, does not work and is a bit 'quirky': it basically puts me in a root-environment, then executes the command when exiting the shell. When I use sudo -s | yum clean all (which I think is what you ment), it does not work and waits for me to break. – Aron Rotteveel Feb 22 '12 at 8:33

I don't understand why this question is featured now, but it seems to me that the problem lies with resource limits. You should run ulimit -v (and perhaps ulimit -m too) and check whether you have any memory limits enforced, as most likely sudo (without -i) won't clear them.

share|improve this answer
this helped me, I've set ulimit -m unlimited and it worked. – w00t Dec 28 '12 at 13:55

It looks like it's lacking something in the environment that root has. Does 'sudo su - -c "yum clean all"' work?

share|improve this answer
It seems like sudo - is not working on CentOS. Getting sudo: '-' requires an argument. It seems like a missing PATH entry indeed. Besides altering the sudo alias to include the path, is there anything else I can do? – Aron Rotteveel Apr 29 '10 at 11:48
Edited my response, I had the command wrong. – sinping Apr 29 '10 at 12:25
Actually, have you checked the permissions on those python modules? Does your account have read access to them at least? – sinping Apr 29 '10 at 12:33
Checked it and yes. The modules are chmodded 0755 and are readable. – Aron Rotteveel Jun 30 '10 at 6:36

Perhaps SELinux is to blame. Is it enabled? Try getenforce if you are unsure about that.

share|improve this answer
Thanks for the reply, but nope. Not running SELinux. – Aron Rotteveel Aug 2 '10 at 7:22

Try to use strace to look what's wrong.

share|improve this answer
up vote 0 down vote accepted

It seems this problem has been solved. I have evaded this problem by simply using sudo -i but just tried using sudo combined with yum and it works. I have no idea what solved it, but I assume a package update has implemented a fix for this issue.

For reference sake, here are my current versions:

  • Sudo version 1.7.2p1
  • Yum version 3.2.22
  • Kernel 2.6.18-308.16.1.el5
  • CentOS 5.5
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.