1

I was trying to install a python rpm on AIX 6.1 and it was taking too long and so I had to close ther terminal.

Later when I tried to install the same rpm as root I am getting the problem as :

root:stud -> $ rpm -i -v python-2.6.7-1.aix5.1.ppc.rpm
cannot get exclusive lock on database
error: cannot open /opt/freeware/packages/packages.rpm

How can I correct this.

And on executing ps aux | egrep -i 'yum|rpm' I get:

root:stud-> $  ps aux | egrep -i 'yum|rpm'
root     2359514  0.0  0.0  240  252  pts/1 A    09:32:10  0:00 egrep -i yum|rp
gautam vegeta
  • 115
  • 1
  • 6

1 Answers1

2

It simple means that there is some other process which is having the lock for rpm and not giving you the access. Check for any processes which might use rpm in your machine.

This command should probably help:

# ps aux | egrep -i 'yum|rpm'

If this command shows you some process (which it should), you should either wait for that process to exit and kill the process if it's not needed.

If it doesn't, try your command again, and it should work.

You can also check for the lock file also in the location /var/lib/rpm.

Simply go to that directory and check for the lock file. If it's there, which most probably is stale, as you killed the terminal earlier, simply remove the lock file.

If that also doesn't work, try rebuilding the RPM DB with this:

 # rpm  --rebuilddb
Napster_X
  • 3,373
  • 18
  • 20
  • when I tried the command I got this result : `root 2359514 0.0 0.0 240 252 pts/1 A 09:32:10 0:00 egrep -i yum|rp` So should I be killing this process.How can I confirm this is rpm process. – gautam vegeta Jan 13 '13 at 14:33
  • I can't make anything out of this output here. Can you please edit the post and put it there or may be use something like pastebin and let me know – Napster_X Jan 13 '13 at 14:44
  • 1
    Also, to the person who voted -ve on my answer, I would really appreciate a feedback that why you did that ... and if you can't give the feedback, please don't vote – Napster_X Jan 13 '13 at 14:44
  • I have updated the question and posted the result. – gautam vegeta Jan 13 '13 at 14:48
  • Hmmm .. doesn't look that there is any other process running on the machine which is using the lock. Let me see if I can think of something else – Napster_X Jan 13 '13 at 14:51
  • Updated my answer, you can give it a shot – Napster_X Jan 13 '13 at 15:09
  • But if i do ps -u root i get one process using rpm.Can that be one to be killed? – gautam vegeta Jan 13 '13 at 15:11
  • Naah. That's the same process what you ran to check any other process. I was automatically finished as soon as you saw the output. – Napster_X Jan 13 '13 at 15:12
  • I tried cheking the location `/var/lib/rpm` but there were no lock files.Then I tried `rpm --rebuilddb` command and got the error as `cannot get shared lock on database` – gautam vegeta Jan 13 '13 at 15:16
  • Looks like you already got the answer in other forum :) I was expecting the same, that you are not root as your prompt was "$", but didn't say that as you already specified that you are root :( – Napster_X Jan 13 '13 at 18:35