I am slowly making progress on installing Fedora into a Logical Volume for a DomU using Package Management. I have (with the help of the wonderful people at Unix & Linux) resolved a number of issues, mainly surrounding rpm (see links below):

I am using the --root option with rpm to change my newly built version of rpm to /mnt/fedRoot. I have also directed rpm to look at the rpmrc file in the build folder, rather than on the actual /var/lib/rpm. Now Unfortunately, on any rpm file I run though I am getting: error: can't create transaction lock on /mnt/fedRoot (Is a directory). Looking online, I found a few pages that indicated this was an issue with the __db.*. Though deleting them and rebuilding the db within my rpm folder fixed another issue, I am still getting the transaction lock error.

Anyone have insight into this error?

  • 1
    If you have a file called /var/lock/rpm/transaction, try deleting it.
    – fpmurphy
    Jun 18, 2011 at 14:57
  • 1
    does the directory /mnt/fedRoot/var/lib/rpm exist ? in analogy to redhat.com/archives/rpm-list/2007-May/msg00046.html , what does rpm --root=/mnt/fedRoot -E '%{_rpmlock_path}' say ? Jun 19, 2011 at 19:28
  • 1
    Any updates on this problem? Answers to the two suggestions above?
    – Caleb
    Jun 26, 2011 at 21:56
  • Sorry for the lack of response, thanks for keeping me honest @Caleb. The command pointed to /usr/lib/rpm/macros. I think the issue was, I was trying to use a version of a fedora install rpm that wasnt compatible with the CentOS rpm I was using. I dont know if that actually makes sense (to linux experts), but I was able to install another version of CentOS without any issues, so that is what I am basing this on. I have decided to take a step back and try to learn a bit more about linux before I attempt a full-blown xen system again. For now I am using Fedora 14 as my main system. Jun 26, 2011 at 22:07

8 Answers 8


Try running your command as root. It worked for me.

  • 1
    Why does running as root work? May 31, 2013 at 16:48
  • Yes why does it require root user access ? Apr 21, 2018 at 8:14

Something else is holding that lock. Wait a while. (It is usually the graphical package management tool refreshing it's view of what's available, or perhaps a run of yum).


check the file level permission for the root user, it has to be (read write and execute)

$ls -l /var/lib/rpm/.rpm.lock

Try removing the /var/lib/rpm/.rpm.lock file (need to be root to do this). That fixed it for me.

  • 7
    Now getting error can't create transaction lock on /var/lib/rpm/.rpm.lock (No such file or directory)
    – shashwat
    Sep 8, 2015 at 12:46

2019 Update:::

Ran into a similar problem as asked ( RPM failed: error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Resource temporarily unavailable) )

Solved by;

ps -ef|grep rpm

And killing 2 orphan rpm processes as shown below ;

rpm --root / --dbpath /var/lib/rpm -i --percent --noglob --force --nodeps -- /var/cache/zypp/packages/download.o
/bin/sh /var/tmp/rpm-tmp.uHUmw1 7

I was then able to proceed with upgrading packages


Got this issue as well today. I fixed with below command to make sure its folder is created.

mkdir -p /var/lib/rpm

I was getting the same error, from trying the following under Scientific Linux release 6.10:

$ rpm -ivh ~/Downloads/kernel-rt-`uname -r`.rpm
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

My intent was to install the Kernel source package as a normal user to perform a build, and therefore spent a few hours trying to find why rpm needed to create the transaction lock when I wanted to install the source package under ~/rpmbuild.

Eventually realised my error was kernel-rt-`uname -r`.rpm was expanding to the pre-built rpm for the running Kernel, and not the src.rpm file I actually wanted.

Actually specifying the name of the source rpm then worked to actually install the source package into ~/rpmbuild:

$ rpm -ivh ~/Downloads/kernel-rt-3.10.33-rt32.33.el6rt.src.rpm 
   1:kernel-rt              warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
<<snip remove duplicate warnings>>
$ ls ~/rpmbuild/SOURCES/
$ ls ~/rpmbuild/SPECS/

As you are having error of 'can't create the transaction lock on rpm', to solve this error and get install the required package on your machine you just have to login to your root user through terminal window 'su -root' and then install your rpm package. The error gets solved.

  • 2
    Can you highlight what your answer adds above and beyond the existing answers?
    – Anthon
    Mar 12, 2014 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .