Package installation failed: cannot open Packages index anymore!

Hi openSUSE community,
Everything was fine until I try to install the package kernel-devel this morning, I obtained an error that I ignored (unwise!).
Now I obtain these errors:

orsos@linux-pkwf:~> sudo zypper clean -a
[sudo] password for root:  
error: rpmdb: __fop_file_setup:  Retry limit (100) exceeded
error: cannot open Packages index using db4 - File exists (17)
Target initialization failed:
Rpm Exception                                                                                                                                                
Cannot clean installed packages cache because of an error.
Some of the repositories have not been cleaned up because of an error.

orsos@linux-pkwf:~> rpm -qa
error: rpmdb: __fop_file_setup:  Retry limit (100) exceeded
error: cannot open Packages index using db4 - File exists (17)
error: cannot open Packages database in /var/lib/rpm
error: rpmdb: __fop_file_setup:  Retry limit (100) exceeded
error: cannot open Packages database in /var/lib/rpm

Is there any way out of this?
Thanks!

Try

rpm --rebuilddb

Here we are:

orsos@linux-pkwf:~> sudo rpm --rebuilddb
[sudo] password for root:  
error: rpmdb: __fop_file_setup:  Retry limit (100) exceeded
error: cannot open Packages index using db4 - File exists (17)

How bad is this?

Follow (carefully!) the full RPM Database Recovery procedure as shown here:

http://rpm.org/user_doc/db_recovery.html

If errors occur don’t ignore them… :wink:

I started the procedure on http://rpm.org/user_doc/db_recovery.html


orsos@linux-pkwf:/var/lib/rpm> sudo /usr/lib/rpm/rpmdb_stat -CA
[sudo] password for root:  
rpmdb_stat: DB_ENV->open: No such file or directory


orsos@linux-pkwf:/var/lib/rpm> lsof | grep /var/lib/rpm
bash      2937           orsos  cwd       DIR               0,39       276      34718 **/var/lib/rpm**
lsof      3031           orsos  cwd       DIR               0,39       276      34718 **/var/lib/rpm**
grep      3032           orsos  cwd       DIR               0,39       276      34718 **/var/lib/rpm**
lsof      3033           orsos  cwd       DIR               0,39       276      34718 **/var/lib/rpm**

I did a backup of the rpm.
The following command returns nothing

sudo /usr/lib/rpm/rpmdb_verify Packages

Everything good so far?

When I do…

sudo rpm -qa

…nothing is printed in my console, meaning no installed rpm recognized, right?
Should I attempt at following this cookbook https://www.informatimago.com/linux/rpm-rebuilddb.html ?

Not looking too good :frowning:

Yes, as the rpm database does seem rather broken, you’ve probably little to lose by trying that procedure, but I’ve no idea of the likelihood of a successful outcome.

Prior to attempting that it may be worthwhile asking on the rpm mailing list, (see: http://rpm.org/community.html ) where there are likely more knowledgeable people who may offer better or alternate advice.

I only just saw you had another thread, No space left on device, uncommon cause? - Install/Boot/Login - openSUSE Forums

It is quite possible as a result of that, the rpm database is in an indeterminate state… :\

In the end, I simply reinstalled the system and now everything back on track. For my abilities, less time consuming than rebuilding the RPM db from scratch, or at least I could not find an “easy” fix.

If all this is true, then, it seems that, when the system partition(s) are located within a Btrfs file system which has become full, there is a danger that, the system’s RPM database will be irrecoverably corrupted.
[HR][/HR]Which means that, the RPM database will need to be re-populated from an examination of the installed system files.

  • Catch 22: the system directories are also located within the Btrfs file system (which was over-full) and therefore, are, possibly, also corrupted.

Therefore, IMHO, the only valid solutions are:

  1. Attempt to initialise a new RPM database from knowledge of the installed system files – the installed RPM package list may, however, be incomplete because, some of the system files located within the Btrfs file system (which was over-full) have been corrupted;
  2. Restore the partitions located within the Btrfs file system from a reliable – confirmed reliable
    – system backup; 1. Reinstall the system from scratch.