1

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?

ThomasReggi
  • 621
  • 2
  • 10
  • 25

2 Answers2

5

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
1

Found the answer here: Passing PATH through sudo

sudo nano /etc/sudoers
ctrl + w (nano search)
"usr/bn"
replaced it with "usr/bin"
ThomasReggi
  • 621
  • 2
  • 10
  • 25
  • 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