I normally start with a Minimal Centos 7 and run

rpm -i postgres10-libs-10.15-1PGDG.rhel7.x86_64.rpm 

And this works perfectly.

However, I am now writing an RPM spec file and trying to get it to do the same thing in the post installation like:

rpm -i postgres10-libs-10.15-1PGDG.rhel7.x86_64.rpm 

However, when I do

yum install my-rpm-1.0.0.el7.x86_64.rpm

it stalls on the rpm -i line. The reason I know this is because when I do

ps -ef

I can see

 rpm -i postgres10-libs-10.15-1PGDG.rhel7.x86_64.rpm 

never completes.

Does anyone know why rpm -i does not work in a spec file, but does when in a plain old terminal?

1 Answer 1


There is a good chance your RPM database is trying to eat itself at that point. The DB is already open, but then you're tryin to open it again before it's closed. You're deliberately creating a race condition for RPM, and it doesn't know how to handle it. The correct way to do this is to specify a package corequisite with Requires: in the specfile.

  • I think you are probably correct. The reason I cannot use the Requires clause is because our internal yum repository does not have this specific version of Postgres available. So I have had to manually install Postgres 10 myself. For now, I guess I'll have to remove the rpm -i line and wait for the RPM install to complete. Then I'll proceed to rpm -i command afterwards. Commented Jul 13, 2022 at 21:54
  • Why can’t you just use yum to install the Postgres package directly? It’s really weird that you are putting an RPM inside an RPM.
    – jsbillings
    Commented Jul 14, 2022 at 0:35

You must log in to answer this question.

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