I'm having problems with yum and I am trying to re-install it. I've download yum.3.2.0-40-el6.centos.noarch.rpm.

When I try:

$ rpm -ivh yum.3.2.0-40-el6.centos.noarch.rpm

I get:

error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

I tried running su - and I'm getting this error:

-bash: su: command not found`

I get the same "permission denied error" if I try to uninstall yum and force ignore dependencies (without forcing to ignore dependencies, it fails uninstall with a few dependencies).

  • Are you root or using sudo when you run this command?
    – slm
    Apr 20, 2014 at 22:44
  • @slm, I am not able to get either sudo or su to work (see comment to your answer). Are these the only ways to work as root? Apr 21, 2014 at 16:55
  • What distro is this?
    – slm
    Apr 21, 2014 at 16:56
  • 2
    what is the output of ls -l /bin/su ? command not found seems like you have bigger issues than mere yum.
    – Dani_l
    Nov 10, 2015 at 15:41
  • if this is off-topic in Unix&Linux SE, where would it be on-topic ?
    – Veverke
    Nov 11, 2020 at 10:37

3 Answers 3


This error:

error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

... would appear to be you trying to perform an rpm -ivh ... command as a user other than root.

You'll need to run it like so:

$ sudo rpm -ivh yum.3.2.0-40-el6.centos.noarch.rpm

Also make sure that you're in the directory where you happened to download the yum..rpm file. Perhaps you downloaded as your regular username and are now attempting to install it as root. Note that when you become root you're typically changed directories into /root.

If su - is broken for whatever reason you can also become root like so:

$ sudo -i
  • I am confused on the sudo and su commands. su - gives (see above), and sudo -i gives sudo: unable to stat /etc/sudoers: No such file or directory sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin Apr 21, 2014 at 16:54

Run sudo su before and it works :)

  • 2
    if su - returns "su: command not found", this won't work either. The real problem is why and how /bin/su disappeared.
    – lgeorget
    Sep 16, 2016 at 6:50
  • 1
    it works for me. Oct 14, 2016 at 19:42

Try running $ sudo rm /var/lib/rpm/.rpm.lock

  • Why not? We are certainly on a container nowadays... So you may do nasty things like that, if it works.
    – Sandburg
    Aug 14, 2020 at 8:35

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