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/datetime.so: 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:
  http://wiki.linux.duke.edu/YumFaq

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?

link|improve this question

What does it do with sudo -s instead of sudo -i? – Raphink Feb 21 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 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 at 14:07
Hehe. By sudo -s, I meant to do sudo -s; yum clean all. Did you try that? – Raphink Feb 21 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 at 8:33
feedback

2 Answers

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

link|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
feedback

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

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

Your Answer

 
or
required, but never shown

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