Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running a Amazon ec2 instance on amazon's linux.

Whenever I run anything sudo yum it give me this:

sudo: yum: command not found

ec2-user$ rpm -qf /usr/bin/yum
yum-3.2.29-30.24.amzn1.noarch

ec2-user$ which yum
/usr/bin/yum

which yum while in root gives:

root$ which yum
/usr/bin/which: no yum in (/sbin:/bin:/usr/sbin:/usr/bn:/usr/local/bin:/opt/aws/bin)

This is a new ec2 instance two days old. When I first logged in I ran sudo yum update and everything wen't well. What changed?

share|improve this question

2 Answers 2

You have a typo in root's PATH.

Instead of /usr/bin the path entry reads /usr/bn.

I can't be sure if this is because Amazon has screwed up something, or you made a change to your PATH and accidentally deleted the i, but that appears to be the cause of the problem.

share|improve this answer
    
Where can I change that? –  ThomasReggi Nov 28 '12 at 16:12
    
Wherever you set it initially. Perhaps in .bashrc? Though if you didn't set it, it's probably Amazon's fault. I'm not at all impressed with Amazon Linux and I don't recommend it. –  Michael Hampton Nov 28 '12 at 16:22
    
I never set it. –  ThomasReggi Nov 28 '12 at 16:32
    
OK, my recommendation will be "Don't use Amazon Linux". They seem to have a history of breaking important stuff at random times. A real DevOps thing to do, but out here in the real world, we need stable systems. –  Michael Hampton Nov 28 '12 at 16:33
    
Gosh, you may be right. Added export PATH=/usr/bin:$PATH to /root/.bashrc and the error still happened. I had to sudo su and run yum.... –  ThomasReggi Nov 28 '12 at 16:34

Found the answer here: Passing PATH through sudo

sudo nano /etc/sudoers
ctrl + w (nano search)
"usr/bn"
replaced it with "usr/bin"
share|improve this answer
1  
while this may work, you should almost always use visudo to edit sudoers (export EDITOR=nano first) as it will check the syntax before writing the file; if you mess it up (and it's very easy to do ... been there), you can make it impossible to use sudo, which means your server is hosed. Also, I think the answer from Michael Hampton above deserves a checkmark, perhaps with a note indicating you also found the sudoers was also messed up. –  Tom Harrison Jr Nov 29 '12 at 20:22

Your Answer

 
discard

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.